disconnected
In less than 0.5K, it enables connected
and disconnected
element's listeners in hyperHTML, but it can also be used with any other library/vanilla JS.
The only optional dependencies it has are constructable Event
and the WeakSet
. Both must be passed along as configuration object, and polyfills might be needed only for legacy browsers.
// requires both modern Event and WeakSet;const observe = ; ;mainElement;mainElement; ;;;
Compatibility
Even IE9, as long as a usable Event
and WeakSet
are provided.
attributechanged
?
What about You got it, sharing same API, needing same Event
poly, if necessary.
DOM Level 0 Like events ?
Using with-level-0 would make it possible to have el.onconnected = ...
simplification too.
;; // remember to observe the nodevar div = ; // add your Level 0 listenerdiv { divtextContent = 'Level 0';}; // that's it!documentbody; // feel free to clean it up viadivonconnected = null;