Re: [css3-conditional] @supports API

Just a question: wouldn't it better to have a "full parser" that can 
recognize any piece valid CSS ?

window.recognizeCSS("x::scrollbar {}"); // false
window.recognizeCSS("* { width: 1px; }"); // true
window.recognizeCSS("* { -unknown-property: 3 }"); // false



-----Message d'origine----- 
From: L. David Baron
Sent: Monday, October 10, 2011 8:55 PM
To: Peter Beverloo
Cc: Paul Irish ; www-style@w3.org
Subject: 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 Tuesday, 11 October 2011 18:49:39 UTC