Error being thrown into the DOM when trying to create components via JavaScript #529
jordanjones243
started this conversation in
General Auro discussions
Replies: 2 comments 3 replies
-
New issue with similar performance feature request |
Beta Was this translation helpful? Give feedback.
0 replies
-
TODO Items to address this:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
An issue was brought to my attention recently with creating an instance of
auro-popover
through JavaScript that likely can come up in other components:Basically, in most of our components, we have attributes that are applied to our custom elements. These attributes are usually initialized inside of our constructor and some are reflected onto the element in the DOM. Where the issue arises is when we try to create a component using the DOM (via JavaScript). An error is thrown because the DOM is complaining that it cannot create an element that already has attributes applied to it. In this case, we had our
auro-popover
component being created with anid
attribute already being assigned a value in the constructor.What we need to do is go through all of our components and move all of our attributes that are being reflected onto the components from being initialized in the constructor to the
connectedCallback()
function, which runs once an element is attached to the DOM.This simple change from
auro-popover
can be used as a guide to make the change in any other component that can run into this issue:Beta Was this translation helpful? Give feedback.
All reactions