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:32:36 UTC