- From: L. David Baron <dbaron@dbaron.org>
- Date: Tue, 11 Oct 2011 12:32:04 -0700
- To: François REMY <fremycompany_pub@yahoo.fr>
- Cc: Peter Beverloo <peter@lvp-media.com>, Paul Irish <paul.irish@gmail.com>, www-style@w3.org
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