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

[css-content] Computed value of the content property on elements. #1757

Open
emilio opened this issue Aug 24, 2017 · 3 comments
Open

[css-content] Computed value of the content property on elements. #1757

emilio opened this issue Aug 24, 2017 · 3 comments

Comments

@emilio
Copy link
Collaborator

emilio commented Aug 24, 2017

Consider the following test-case:

<!doctype html>
<style>
.first::before, .second::after {
  content: inherit;
}
</style>
<p>Test passes if you see two PASS lines below:</p>
<div class="first" style="content: 'PA'">SS</div>
<div class="second" style="content: 'SS'">PA</div>

The CSS22 spec, according to @rune-opera, said that content always computed to normal for elements. But that's gone from the new specs.

Gecko passes the above test-case, Blink and WebKit don't, presumably applying the CSS2 rule.

However, Chromium and WebKit do alert foo (note: incorrectly serialized) in the following test-case, which I suppose should alert normal per the reasoning above:

<p id="test" style="content: 'foo'"></p>
<script>
alert(getComputedStyle(test).content);
</script>

So, question is: What's the desired behavior? Should we keep content computing to normal for non-pseudos? What's the computed value of content in the string and images cases?

I personally think Gecko's behavior is sane, and less special-case-y, but would be nice to at least have a spec everyone could implement.

Relevant browser bugs:

@emilio
Copy link
Collaborator Author

emilio commented Aug 28, 2017

I have tests for the Gecko behaviour that could be upstreamed if the WG specifies that in https://bugzilla.mozilla.org/show_bug.cgi?id=1385154.

@foolip
Copy link
Member

foolip commented Oct 3, 2017

@emilio you mentioned that this is a blocker for removing some non-standard thing in Gecko. Can you point to that issue?

@emilio
Copy link
Collaborator Author

emilio commented Oct 3, 2017

Nope, not this one.

Figuring out what should happen in #1548 (in particular when called in elements from different documents) would be nice. Though after taking another look at the bug I mentioned (https://bugzilla.mozilla.org/show_bug.cgi?id=548397, which prevents us from removing window.getDefaultComputedStyle), that's mostly about figuring out what should happen in a display: none iframe (not necessarily when called cross-doc, though I know that's highly inconsistent).

There's extended discussion in that in whatwg/html#1813 and a bunch of related issues linked from there though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants