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 21:43:04 +0200
Message-ID: <BF9DA122D53D4747993B0193565E1568@FREMYD2>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: "Peter Beverloo" <peter@lvp-media.com>, "Paul Irish" <paul.irish@gmail.com>, <www-style@w3.org>
To me, it seems like any error should be handled by having the API return 
false. Are there any case where you would prefer doing otherwhise? The main 
problem may rather be: How simple is it to catch all CSS errors with a 
parser that has been made to overcome any error, and not especially 
"throwing" or "notifying" about them.



-----Message d'origine----- 
From: L. David Baron
Sent: Tuesday, October 11, 2011 9:32 PM
To: FrançoisREMY
Cc: Peter Beverloo ; Paul Irish ; www-style@w3.org
Subject: Re: [css3-conditional] @supports API

On Tuesday 2011-10-11 20:48 +0200, François REMY wrote:
> 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

The problem with that approach is that a full parser has rules for
ignoring invalid things at certain points:  for example, while
parsing a rule, invalid declarations are dropped; while parsing the
top level of a style sheet, invalid rules are dropped.  (There are
further rules for media queries and for handling of errors inside
various types of @-rules.)

With an API like this, it's not clear which errors are handled by
dropping (as per the normal parsing rules) and which are handled by
having the API return false.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂 
Received on Tuesday, 11 October 2011 19:43:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:45 GMT