Bug 14007

Summary: Unclosed CSS block causes incorrect handling of rest of stylesheet
Product: WebKit Reporter: Elliott Sprehn <esprehn>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ap, bfulgham
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Unclosed block followed by non-type selector.
none
Unclosed Block Followed By Type Selector none

Description Elliott Sprehn 2007-06-05 16:14:06 PDT
If a block is not closed and the rule following it is not a type selector then unclosed block and all rules until the end of the are ignored.

Reproducible in Safari 2 and the latest nightly (Mon Jun 4 23:39:30 GMT 2007, 21970).
Comment 1 Elliott Sprehn 2007-06-05 16:17:52 PDT
Created attachment 14871 [details]
Unclosed block followed by non-type selector.

The text in the examples should be colored the same as the color for each word.
Comment 2 Elliott Sprehn 2007-06-05 16:19:41 PDT
Created attachment 14872 [details]
Unclosed Block Followed By Type Selector

Text should be colored the same as word specifies.
Comment 3 Elliott Sprehn 2007-06-05 16:25:47 PDT
Apparently the handling seems to differ based on if there's a type or non-type selector after the unclosed block. Both behaviors are wrong as per the spec and behavior of FireFox and IE.

If there's a type selector Webkit ignores the entire rest of the sheet and the rules in the unclosed block.

If there's no type selector Webkit closes the block at the next rule, ignores the that rule, but doesn't ignore the rest of the stylesheet or the rule that was missing the close brace.

Behavior as per the spec and the what other browsers do is to make the whole rest of the sheet into "invalid rules" and ignore them, but to respect the rules in the unclosed block that happened before the next rule was encountered.
Comment 4 David Kilzer (:ddkilzer) 2007-06-05 17:00:49 PDT
Confirmed with a local debug build of WebKit r21976 with Safari 2.0.4 (419.3) on Mac OS X 10.4.9 (8P135).

Both examples work in Firefox 2.0.0.4 and Opera 9.10.

Comment 5 Sam Weinig 2007-06-06 00:36:59 PDT
Is this the same bug as 12558?
Comment 6 Alexey Proskuryakov 2007-06-06 04:13:48 PDT
I'm not sure if this can be closed as a duplicate - but it's closely related for sure.
Comment 7 Alexey Proskuryakov 2008-11-28 14:01:28 PST
Bug 12558 is fixed now, but this is not.
Comment 8 Brent Fulgham 2022-07-07 12:32:06 PDT
Safari, Chrome, and Firefox produce the same output for both test cases. I don't believe any compatibility issues remain for this bug.