Bug with clamp.js - a.lastChild is null

675 views Asked by At

I am trying to use clamp.js but I get a bug right away. This is my code

 <!DOCTYPE html>
<html lang="en">
    <head>
        <title>test</title>

        <script src="js/plugin/clamp.min.js"></script>


    </head>

    <body>

        <div id="test" style="width:200px; height:200px;">
            AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA AAAAAA 
        </div>

        <script>
            var e = document.getElementById("test");
            var r = $clamp(e, {clamp: 1, useNativeClamp :false});
            console.log(r);
        </script>

    </body>

</html> 

And I get TypeError: a.lastChild is null[Learn More] in firefox, and Uncaught TypeError: Cannot read property 'children' of null in chrome.

This is the file I am using clamp.min.js.

Does anyone know what could be the problem?

Thanks

0

There are 0 answers