0

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

omega
  • 40,311
  • 81
  • 251
  • 474
  • The issue is with `useNativeClamp :false`. After removing this option, it works. – Tushar Dec 27 '16 at 06:10
  • If I remove it, it partially works in chrome, but same error in firefox. Also in chrome it doesn't respect the height I give it, it just uses the 200px still. The above should make it 1 line, but its still multiline. – omega Dec 27 '16 at 06:13

0 Answers0