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
When registering the polyfill and a custom element in the head, and the custom element is present in the body when initializing the page (either by putting it directly in the page's HTML, or by using document.write), the attributeChangedCallback won't fire for the element's attributes.
This is especially problematic, because it breaks functionality of all web components, not just web components that use the scoped registry.
Including the polyfill broke unrelated functionality in our application.
Example
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><scriptsrc="https://unpkg.com/@webcomponents/scoped-custom-element-registry@0.0.9/src/scoped-custom-element-registry.js"></script><script>customElements.define('my-element',classMyElementextendsHTMLElement{staticgetobservedAttributes(){return['param'];}attributeChangedCallback(name,oldValue,newValue){console.log('attributeChangedCallback',{ name, oldValue, newValue });}});</script></head><body><!-- This should trigger the attributeChangedCallback, which logs to the console --><my-elementparam="value"></my-element></body></html>
When the component initializes, the attributeChangedCallback should fire and the added attributes should be logged to the console.
When the polyfill is present, the attributeChangedCallback won't fire when the component is initialized.
When the polyfill is disabled, the attributeChangedCallback fires as expected.
Expected behavior
I expect the attributeChangedCallback to fire for every attribute when the component is initialized.
Actual behavior
The attributeChangedCallback isn't executed.
Version
0.0.9
Browsers affected
Chrome
Firefox
Edge
Safari
IE 11
(only browsers I could test)
The text was updated successfully, but these errors were encountered:
Description
When registering the polyfill and a custom element in the head, and the custom element is present in the body when initializing the page (either by putting it directly in the page's HTML, or by using
document.write
), theattributeChangedCallback
won't fire for the element's attributes.This is especially problematic, because it breaks functionality of all web components, not just web components that use the scoped registry.
Including the polyfill broke unrelated functionality in our application.
Example
When the component initializes, the attributeChangedCallback should fire and the added attributes should be logged to the console.
When the polyfill is present, the
attributeChangedCallback
won't fire when the component is initialized.When the polyfill is disabled, the
attributeChangedCallback
fires as expected.Expected behavior
I expect the
attributeChangedCallback
to fire for every attribute when the component is initialized.Actual behavior
The
attributeChangedCallback
isn't executed.Version
0.0.9
Browsers affected
(only browsers I could test)
The text was updated successfully, but these errors were encountered: