You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.
The presence of script elements in a document affects how custom elements are initialized.
What appears to be happening is that the presence of a script element with content (code or just whitespace), the custom element's initialization method is called at the point that the script element is processed in the DOM. So if the script element is before the dojo-button element in the DOM, initialization is called before dojo-button has been processed, so the node is empty (document.body.childNodes at this point contains only a whitespace text node and the script node). If the script element is after dojo-button, the button's content is available in initialization. However, if additional nodes are added to the document after the script element it can be seen that processing is still affected by the presence of the script tag, as document.body.childNodes will only contain nodes up to the script node.
The issue seems to be that if a script element with content (either inline or via a src attribute) occurs after the custom element import, it causes the custom element's initialization method to run too early (at the point in the doc where the script element is encountered).
Bug
The presence of
script
elements in a document affects how custom elements are initialized.What appears to be happening is that the presence of a
script
element with content (code or just whitespace), the custom element'sinitialization
method is called at the point that thescript
element is processed in the DOM. So if thescript
element is before thedojo-button
element in the DOM,initialization
is called beforedojo-button
has been processed, so the node is empty (document.body.childNodes
at this point contains only a whitespace text node and thescript
node). If thescript
element is afterdojo-button
, the button's content is available ininitialization
. However, if additional nodes are added to the document after thescript
element it can be seen that processing is still affected by the presence of the script tag, asdocument.body.childNodes
will only contain nodes up to thescript
node.Package Version: 0.3.0
Code
Expected behavior:
element.innerHTML
should equal "Click me".Actual behavior:
element.innerHTML
is empty.The text was updated successfully, but these errors were encountered: