Description
As listed in the platform/shadow-dom docs as a known issue;
No live NodeLists. All node lists are snapshotted upon read.
One must assume this is just for query methods within a shadowDOM, not the entire document! But, alas, this is not so... The ShadowDOMPolyfill wraps way too much, including the document
object even if no ShadowDOMs exist!? Thus, there are no live NodeLists, as the ShadowDOMPolyfill monkeypatches methods like document.getElementsByTagName
and replaces it with the sluggish and static querySelectorAll
.
To compound matters, ShadowDOMPolyfill.unwrap(document)
throws Error: Assertion failed
. How does one find the real document.getElementsByTagName
?
Completely eliminating live NodeLists is a perf deal breaker for me and I'm sure anyone else that is writing perf-minded DOM libs that ought to work with Polymer.
The ShadowDOMPolyfill should not require developers to jump through unwrap
or .impl
hoops when using DOM APIs outside of a shadowRoot. It is against the nature of what makes us love polyfills and the awesomeness of Polymer.
For the sake of my sanity, I assume this is well understood to be a temporary fix to what must be a daunting polyfill.