Re: [css3-conditional] @supports API

On Monday 2011-10-10 19:33 +0100, Peter Beverloo wrote:
> The primary reason for matchMedia to return a MediaQueryList object is that
> media queries can change while the page is active, and thus provides
> listeners for it.  Considering an engine's support for certain CSS
> properties is unlikely to change during a page's execution, a simpler API
> may be more appropriate.
> 
> window.supportsStyle('width: 1fr');
> 
> Going even further, part of the parsing step could be circumvented by
> accepting two arguments, the property name and the value:
> 
> window.supportsStyle('width', '1fr');
> 
> Neither would not support checking multiple property-value pairs at once,
> but it reduces complexity significantly.

Agreed; I think I like the second form better.  Support for handling
'or', 'and', and 'not' isn't needed for JS callers, since JS has
those already.

(I might be inclined towards supportsCSS rather than supportsStyle,
but I'd be open to better suggestions.  CSS seems more specific, but
maybe it's too specific in the wrong way, in that people would
expect it to take arbitrary CSS.)

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Monday, 10 October 2011 18:56:23 UTC