3 ms·
Good step in the right direction. Now we need the same thing for JavaScript.
by MatthewPhillips 14y ago
Good step in the right direction. Now we need the same thing for JavaScript.
- notatoad 14y agoJavaScript already has this, no? Just check to see if a function is typeof undefined.
- MatthewPhillips 14y agoI meant to test of HTML5/CSS features are supported through JavaScript. For example, if I want to know if the browser supports <input type="number" /> it's not as easy as it should be.
- eli 14y agoFair enough. Though that's exactly what http://modernizr.com/ http://modernizr.com/ provides, no? I realize nobody likes adding extra JS libraries, but if your only trying to access these properties from JS to begin with it doesn't seem like that big a deal.
- paulirish 14y agoIt does, but since browsers have no defined API for this Modernizr deals with quite a few false positives. Putting the onus on browsers to accurately describe what features are present is good. Plus it's always a good thing to kill off javascript libraries; we don't want to always keep sending JS down the wire when the platform should have this stuff by default.
- deleted 14y ago[deleted]
- paulirish 14y agoMe too! When @supports was proposed I made sure to propose a JS API for the same functionality. David Baron liked the idea and it's now (mostly) in the spec: http://dev.w3.org/csswg/css3-conditional/#window-api http://dev.w3.org/csswg/css3-conditional/#window-api Right after @supports landed I got a bug filed for supportsCSS() https://bugzilla.mozilla.org/show_bug.cgi?id=779917 https://bugzilla.mozilla.org/show_bug.cgi?id=779917 and a few days later an initial patch landed. So I think we're all set here. Also on browser support: Opera already has an implementation in progress of @supports; we haven't seen patches yet from WebKit but there is definitely interest.