Skip to content
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

Correct assorted issues with standalone pseudo elements #43784

Merged
merged 2 commits into from
Dec 25, 2023

Conversation

annevk
Copy link
Member

@annevk annevk commented Dec 24, 2023

I discovered these issues while writing WebKit/WebKit#22231. Standalone pseudo-elements still need to be properly formatted.

And ::placeholder is a valid pseudo-element.

Closes w3c/csswg-drafts#9751.

I discovered these issues while writing WebKit/WebKit#22231. Standalone pseudo-elements still need to be properly formatted.

And ::placeholder is a valid pseudo-element.

Closes w3c/csswg-drafts#9751.
@annevk
Copy link
Member Author

annevk commented Dec 24, 2023

The negative case of the ::view-transition stuff is covered by https://github.com/web-platform-tests/wpt/blob/master/css/cssom/getComputedStyle-pseudo.html. In particular the :marker test. Could probably have more coverage though.

@annevk annevk requested a review from nt1m December 24, 2023 14:23
Comment on lines 38 to +39
let style = getComputedStyle(
document.documentElement, ":view-transition");
document.documentElement, "::view-transition");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a test that this is invalid, I know @karlcow had created a test about getComputedStyle + pseudo elements, so it could be added there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test(function() {
let li = document.querySelector('li');
assert_true(
getComputedStyle(li, ':marker').length == 0,
"Should return an empty style for :marker");
assert_true(
getComputedStyle(li, 'marker').length != 0,
"Should return the element style for marker");
assert_equals(
getComputedStyle(li, 'marker').color, "rgb(255, 0, 0)",
"Should return the element style for marker (ex: color is rgb(255, 0, 0), not rgb(0, 128, 0)");
assert_equals(
getComputedStyle(li, '::marker').color, "rgb(0, 128, 0)",
"Should return the element style for marker (ex: color is rgb(0, 128, 0)");
}, "Unknown pseudo-element with a known string (ex: marker)");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also pointed to this above. I think that's okay for now, but we could add more coverage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change that test to loop over different pseudo elements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could probably cover all of them. That would make sure nothing bad is happening. With the loop being outside of the test. So we know which pseudo-element fails instead of failing everything if one is missing.

css/css-view-transitions/style-inheritance.html Outdated Show resolved Hide resolved
@@ -253,7 +253,6 @@
'before',
':abc',
'::abc',
'::placeholder',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was considered invalid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they previously prohibited -webkit-prefixed pseudo-elements and maybe this is a leftover of that, but not sure.

@annevk annevk merged commit 3d8c4cd into master Dec 25, 2023
19 checks passed
@annevk annevk deleted the annevk/standalone-pseudos branch December 25, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[web-animations] Why is ::placeholder considered invalid?
5 participants