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

[cssom] getComputedStyle for non-existent pseudo-element #1761

Open
zcorpan opened this issue Aug 28, 2017 · 3 comments
Open

[cssom] getComputedStyle for non-existent pseudo-element #1761

zcorpan opened this issue Aug 28, 2017 · 3 comments
Labels
cssom-1 Current Work

Comments

@zcorpan
Copy link
Member

zcorpan commented Aug 28, 2017

https://drafts.csswg.org/cssom/#resolved-values

width
...
If the property applies to the element or pseudo-element and the resolved value of the display property is not none or contents, then the resolved value is the used value. Otherwise the resolved value is the computed value.

See web-platform-tests/wpt#7020

What should happen for getComputedStyle(el, '::before').width if el has no ::before box generated? This appears to not be particularly well defined.

https://drafts.csswg.org/cssom/#terminology says

In this specification the ::before and ::after pseudo-elements are assumed to exist for all elements even if no box is generated for them.

@zcorpan zcorpan added the cssom-1 Current Work label Aug 28, 2017
@Loirooriol
Copy link
Contributor

I would expect the same behavior as when an element does not generate boxes due to display: none or display: contents. In fact the spec is also missing the case of an element whose display is not none or contents but no box is generated due to a display: none ancestor. Then, all Firefox, Chrome and Edge return the computed value, but according to the spec it seems it should be the used value.

@tabatkins
Copy link
Member

Yup, it should be the same as a display:none element. (In other words, the pseudo-element always exists, but most of the time just doesn't generate a box due to content.)

@FremyCompany
Copy link
Contributor

Could probably be merged with #2149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cssom-1 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants