Re: Error Parsing

This is great to know... I've been looking for a way to exclude Safari
from applying a rule for a while =) However, Safari actually stops
parsing any subsequent rules in style sheet, unless followed by another
declaration within the same rule. If followed by another declaration
then it only ignores that and parses the entire stylesheet in the same
way that other browsers do.


I did some quick investigations myself:

EXAMPLE 1
	selector
	{
		property1:value;
		property2: value;
		*/
	}

Safari does *not* applied the entire rule, and ignores subsequent rules.
Others applies the rule.

EXAMPLE 2
	selector
	{
		property1:value;
		*/
		property2: value;
		
	}

Safari, and Others ignore the only following declaration.


The spec says: "This specification defines ignore to mean that the user
agent parses the illegal part (in order to find its beginning and end),
but otherwise acts as if it had not been there."

The error in example 1 is not the inclusion of a close comment token
rather a missing opening comment token, therefore Safari and Omniweb
(webkit) correctly ignore the entire rule. However, they incorrectly 
stop parsing the rest of the stylesheet. Other browsers apply the rule
treating the close comment token as the beginning of the parsing error
seemingly not taking into account what type of parsing error has occurred.

In example 2 webkit and other browsers parse the close comment token as
the beginning of an error and ignore subsequent declarations 
(i.e.property2).

Therefore, I have to conclude webkit is correct in it's handling of the 
error in example 1 assuming it understands the error is a missing open 
comment token. But because it stops parsing the remaining rules in the 
stylesheet, and it's behavior is inconsistent in handling the error 
(example 1 c.f. example 2), I think that it is broken and it is purely 
coincidental that it is a closing comment token that triggers the error.


./tdw


On 2004-10-22 1:18 PM, Philippe Wittenbergh wrote:
> 
> Considering the following rule:
> p {
> color:red;
> */
> }
> Which is obviously malformed.
> Should an UA ignore the entire rule set, or just ignore the loose */ ?
> Most browsers tested display the paragraph in red.
> Safari and Omniweb ignore the rule set.
> 
> Reading <http://www.w3.org/TR/CSS21/syndata.html#parsing-errors>,
> I'm a bit in doubt in this particular case.
> 
> Philippe
> --/--\--
> Philippe Wittenbergh
> blog : <http://emps.l-c-n.com/>
> code | design | webprojects <http://www.l-c-n.com/>
> IE5  Mac bugs and oddities <http://www.l-c-n.com/IE5tests/>
> 
> 
> 

Received on Friday, 22 October 2004 02:37:13 UTC