-
Notifications
You must be signed in to change notification settings - Fork 711
[css-syntax-3] New parsing algorithms do not handle }
tokens correctly in style attributes
#11113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
This resonated with me somewhat, so after some digging, it seems the related changes, listed below in chronological order, followed a comment from me: In a style {
background:red;
}
/* trash */
; background:limegreen An orphan |
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
cdoublev
added a commit
to cdoublev/css
that referenced
this issue
Dec 19, 2024
Declarations are no longer hoisted or wrapped in a style rule. Some problem remains... 1. @font-feature-values, @function, @page, can also have declarations interleaved with rules, but CSSNestedDeclarations is currently associated to style properties. (w3c/csswg-drafts#11272) 2. "}" should be ignored in a "style" attribute value (a declaration block) but the algorithm has been replaced with the same algorithm than for a block of rules and declarations. (w3c/csswg-drafts#11113) 3. The current text wants declarations interleaved by an invalid at-rule or an invalid (qualified) rule error to be separated, but the reason is not stated and no browser does this. (w3c/csswg-drafts#11271) 4. The current text clearly has some other minor typos and is not clear about whether rules and declaration, or only rules, should be returned. (w3c/csswg-drafts#11017)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This WPT test checks that
}
tokens inside astyle
attribute are ignored and skipped over. Specifically, these two cases from it fail when following the new parsing algorithms:The previous version of the spec says:
That then calls "consume a list of declarations", which when it sees a
}
token, discards it and the remaining tokens up until the next;
, and then continues parsing the next declaration.The current draft spec with the new parsing algorithms says:
However, this now calls "consume a block’s contents" which when it sees a
}
, immediately exits out and returns the current list of declarations. This makes it fail the above test cases, because declarations after a}
are completely ignored.A Ladybird contributor has proposed a change which seems to restore the previous behaviour - basically by passing an
is style attribute
flag to "consume a block's contents" and using that to skip over declarations that contain a}
.The text was updated successfully, but these errors were encountered: