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
Originally posted by jordanjones243 March 21, 2024
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 an id 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:
Patrick-Daly-AA
changed the title
Create list of components that need an update to address errors when being dynamically generated by Java Script
Create list of components that need an update to address errors when being dynamically generated by JavaScript
May 22, 2024
Discussed in https://github.com/orgs/AlaskaAirlines/discussions/529
Originally posted by jordanjones243 March 21, 2024
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:The text was updated successfully, but these errors were encountered: