Inspecting attributes in custom element constructor
chaseleslie opened this issue · 2 comments
According to the spec for custom elements:
When authoring custom element constructors, authors are bound by the following conformance requirements:
- ...
- The element's attributes and children must not be inspected, as in the non-upgrade case none will be present, and relying on upgrades makes the element less usable.
- ...
I see that the popup-info-box-web-component example calls this.hasAttribute()
and this.getAttribute()
in the constructor. Maybe the code can be moved to a connectedCallback
method?
Wanted to try the code from the example, found out that this.getAttribute
returns null
in the constructor. Moving all the code from constructor to the connectedCallback
apparently works
Thank you again for filing an issue, @chaseleslie . After looking at existing issues, we have identified this as a duplicate of #34. Therefore, we have referenced this issue in the original one and will close this as a duplicate.