Skip to content

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

@emilio

Description

@emilio

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions