document.getElementById returns null for elements inside html import
Reported by
seandenn...@gmail.com,
Jan 13 2017
|
||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2979.0 Safari/537.36
Steps to reproduce the problem:
1. see [expected behavior] example
What is the expected behavior?
index.html
----------
<link rel="import" href="element.html">
<script>
window.addEventListener(function() {
console.log(document.getElementById('foo')); // null // should be <div id="foo">bar</div>
});
</script>
element.html
------------
<div id="foo">bar</div>
What went wrong?
document query returns null for element inside html import
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: 57.0.2979.0 Channel: dev
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0
,
Jan 14 2017
1) I meant to add the listener to the load event. 2) thanks for that article, I thought I saw it before, but I ended up needing document.currentScript.ownerDocument. One thing to note though is that in my custom element script, in the global zone d.c.o was equal to the document, but from inside the class declaration for the element d.c was equal to null
,
Jan 16 2017
,
Jan 20 2017
Thanks woxxom@ for your insight. @reporter: Shall we close this if it is resolved as per C#1.
,
Jan 22 2017
yes, this is fine to be closed.
,
Jan 24 2017
Thanks all! |
||||
►
Sign in to add a comment |
||||
Comment 1 by woxxom@gmail.com
, Jan 13 2017