WebReflection / linkedom

A triple-linked lists based DOM implementation.
https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
ISC License
1.66k stars 80 forks source link

observedAttributes on custom elements does not work #149

Closed pYr0x closed 2 years ago

pYr0x commented 2 years ago

the attributeChangedCallback and the start of observation is only fired if there is an attribute on the custom element. https://github.com/WebReflection/linkedom/blob/main/cjs/interface/element.js#L266

if you have a custom element with no attributes the attributeChangedCallback is never called.

mdm docs: Note that to get the attributeChangedCallback() callback to fire when an attribute changes, you have to observe the attributes. This is done by specifying a static get observedAttributes() method inside custom element class - this should return an array containing the names of the attributes you want to observe:

we need some like jsdom did: https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js#L156-L162

WebReflection commented 2 years ago

beside the fact I don't care what jsdom does as it's not a goal of this project to be another jsdom, as stated in the README, can you please provide a minimal example of what's the issue here? the code coverage tests Custom Elements and if an element has no attributes then the callback doesn't fire even with native custom elements so I am not sure what are you after.

pYr0x commented 2 years ago

rude answer... i fork this and go on with myself