-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShadowDOMPolyfill is way, way too intrusive! #346
Comments
@bergie, here be the dragons |
side effects may include: document.body != document.getElementsByTagName('body')[0] |
Unfortunately, this is a bit like saying "I really like this 'car' thing, but it's got all this engine stuff inside!" I completely agree that the polyfill is maximally intrusive, but this is a requirement of the problem it is solving. The fact that it works as well as it does in most cases is because of the extreme skill of the author. Fyi, because the browser will not let us override document.body != document.getElementsByTagName('body')[0] but wrap(document.body) === document.getElementsByTagName('body')[0]
You cannot unwrap document because it's not wrapped, as above.
One does not find it, because it will not work properly when employing ShadowDOM. On Wed, Nov 13, 2013 at 9:23 PM, Dan Tocchini notifications@github.comwrote:
|
Is this intrusiveness on the roadmap to be rectified? You can't possibly be telling me that an accepted requirement of a polyfill is rampantly breaking well-standardized functionality outside the scope of the polyfilled feature, and even when the polyfilled feature is not in use... That irreversibly replacing native methods for static ones that are orders of magnitude slower is an accepted requirement? I can imagine this is a supremely difficult polyfill, it's exactly the fact that Polymer is based on polyfilling standards-based power-features in browsers that makes Polymer so much more attractive than the other frameworks. |
The intrusiveness is inherent to the solution, it can't be rectified Various particular performance concerns, patterns, or anti-patterns have Thanks you for pointing out that implementing 'getElementsByTagName' in Ultimately, for high performance applications, it will be hard to beat On Wed, Nov 13, 2013 at 10:54 PM, Dan Tocchini notifications@github.comwrote:
|
Let me first say that I agree with @d4tocchini. The issue is that we have constraints that force us into these kind of incorrect implementations and leaky abstractions. There are a lot of limitations that have forced our hand. I'll outline a few.
The approach we are taking is that we have implemented what is needed to get things working. Yes, sometimes this requires user code to be changed when the web platform is not sufficient to express itself. The good thing is that ShadowDOM is being standardized and implemented in browsers as we speak. If we are successful all the hard code we have created for these polyfills can be deleted. |
As listed in the platform/shadow-dom docs as a known issue;
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 likedocument.getElementsByTagName
and replaces it with the sluggish and staticquerySelectorAll
.To compound matters,
ShadowDOMPolyfill.unwrap(document)
throwsError: Assertion failed
. How does one find the realdocument.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.
The text was updated successfully, but these errors were encountered: