WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WORKSFORME
98905
CSS Error Handling does not handle malformed statement properly.
https://bugs.webkit.org/show_bug.cgi?id=98905
Summary
CSS Error Handling does not handle malformed statement properly.
Pravin D
Reported
2012-10-10 07:57:16 PDT
According to
http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
Spec: Malformed statements. User agents must handle unexpected tokens encountered while parsing a statement by reading until the end of the statement, while observing the rules for matching pairs of (), [], {}, "", and '', and correctly handling escapes. And
http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#parsed-as-a-css-color-value
Spec: user agents are required to close all open constructs upon finding the end of a style sheet unexpectedly. Thus, when parsing the string "rgb(0,0,0" (with a missing close-parenthesis) for a color value, the close parenthesis is implied by this error handling rule, and a value is obtained (the color 'black'). However, the similar construct "rgb(0,0," (with both a missing parenthesis and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a viable value. On Webkit <style> p { background-color:rgb(255,0,0 }; </style> <p> This space must have RED background color. </p> When the style for <p> is examined using inspector, the <p>'s style is changed to background-color: rgb(255,0,0 }; However the css error handling code must have 1st matched/closed the "()" and then "{}".
Attachments
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2012-10-10 08:15:49 PDT
What do other browsers do?
Pravin D
Comment 2
2012-10-10 08:20:04 PDT
(In reply to
comment #1
)
> What do other browsers do? >
Checked on other browsers IE8, FF15 and Opera12. None see to handle this particular error scenario!
Glenn Adams
Comment 3
2012-10-17 02:23:52 PDT
If you are implying that the error handling should consume all tokens to the end of style sheet because it doesn't find a matching right (close) paren, then I don't necessarily agree with your analysis, primarily because the CSS text you cite (about matching pairs) is sufficiently underspecified that it is difficult or impossible to translate to an interoperable implementation. If WK's behavior matches other UA behavior for this example, then it is safe to assume that the behavior is a result of consensual agreement among implementers, and that what needs fixing is the spec language itself. I would suggest you take up your concern with the CSS WG at
www-style@w3.org
.
Brent Fulgham
Comment 4
2022-07-13 11:19:36 PDT
We should revisit this if the specification is amended with guidance.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug