I have amp-script enabled and am testing some examples of what can and cannot be done.
I'm running the following example code:
var elmnt = document.getElementById('element-content');
var class = elmnt.className;
var height = elmnt.scrollHeight;
console.log(class);
console.log(height);
My HTML:
<amp-script layout="container" src="myscript.js" width="300" height="300">
<div class="wrapper content-element" id="element-content">content here</div>
</amp-script>
In this example, the class is being correctly returned in the console, but the height returns undefined and no matter what I do, I cannot get it to return a value.
It's really driving me crazy and I'm wondering if there are some rules/limits on what I can execute.
I've tried looking for any kind of comprehensive documentation but there isn't much and the examples I have found seem to allow much more complex code to successfully run such as:
https://amp.dev/documentation/guides-and-tutorials/develop/custom-javascript-tutorial/
Would appreciate any insight as this is driving me crazy!
scrollHeight
is currently not supported in worder-dom at the moment. You can check out this table for all supported APIs.