- From: Joshua Cranmer <Pidgeot18@verizon.net>
- Date: Thu, 09 Apr 2015 18:23:01 -0500
- To: whatwg@lists.whatwg.org
On 4/9/2015 1:18 PM, Roger Hågensen wrote: > I have, but found that relying on polyfills is no different than > relying on a work around or a 3td party framework. > It easily ads to code bloat, and I'm now moving more and more towards > static pages with JS and CSS specific to a page are embed in the page > as that support fast static delivery. I'm aware of at least one polyfill that works by sniffing the User-Agent and sending only the features that said User-Agent needs. It's also possible (I'm not personally aware of tooling) to make tools that compile out portions of polyfill that are unneeded. > I have seen another approach though to versioning that may be worth > contemplating though... > > Using Javascript one call a function and the browser if this version > is supported. Example: > if (version_supported('javascript',1,2)) Versioned JS, CSS, and HTML have all been considered (and actually attempted, in the case of JS) before, and in all cases they have been rejected. In practice, these languages have seen new features added on a constant basis, with implementers picking up on features here and there; CSS and most of the Web APIs have effectively moved to a highly modularized development, so that features can be stabilized far more quickly. > The browser could then simply return true or false. > True would mean that all features in the speced version is supported. > False would mean that they are not. The number one problem with this sort of feature testing is that it pretends feature support is a purely binary qualifier, whereas the real world is far, far messier. CSS 2.1 support was notoriously buggy in its implementation a decade ago (particularly in the IE browsers), and I don't know if a layout engine exists that actually passes the CSS 2.1 test suite 100%. Layout engines never bothered to fully implement CSS 2 (CSS 2.1 removed some unimplemented features) nor HTML 4. In the end, the question you're trying to ask is "Will this browser support my website?" The de facto solution of using feature detection, possibly with polyfills or UA sniffing as backup, appears to be the most effective way to answer that question. Monolithic versioning doesn't cut it: the answers you get back tend to become political answers rather than useful technical signals. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Received on Thursday, 9 April 2015 23:23:43 UTC