W3C home > Mailing lists > Public > www-style@w3.org > October 2011

Re: [css3-conditional] @supports API

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Tue, 11 Oct 2011 20:48:53 +0200
Message-ID: <25AEEC5723DD4D979EB04FDF31618F74@FREMYD2>
To: "L. David Baron" <dbaron@dbaron.org>, "Peter Beverloo" <peter@lvp-media.com>
Cc: "Paul Irish" <paul.irish@gmail.com>, <www-style@w3.org>
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.)


𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂 
Received on Tuesday, 11 October 2011 18:49:39 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:05 UTC