Closed Bug 1364880 Opened 5 years ago Closed 4 years ago

stylo: The style we return when resolving a pseudo style that doesn't match any rules looks fishy.

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

We return the element style, and I think we should, if only, return a style inheriting from it, instead.
Blocks: stylo
Assignee: nobody → emilio+bugs
Priority: -- → P2
Priority: P2 → P1
Simple testcase showing incorrect behavior:

  <div style="position: absolute"></div>
  <script>
    alert(getComputedStyle(document.querySelector("div"), "::before").position);
  </script>

alerts "absolute", which is wrong; should be "static".
Comment on attachment 8881003 [details]
Bug 1364880: Test non-existent pseudo-element styles.

https://reviewboard.mozilla.org/r/152360/#review157418

::: testing/web-platform/tests/cssom/getComputedStyle-pseudo.html:48
(Diff revision 2)
> +test(function() {
> +  var has_no_pseudos = document.body;
> +  has_no_pseudos.style.position = "relative";
> +  [":before", ":after"].forEach(function(pseudo) {
> +    assert_equals(getComputedStyle(has_no_pseudos, pseudo).position, "static",
> +                  "Unexisting " + pseudo + " pseudo-element shouldn't claim to have " +

s/Unexisting/Nonexistent/

and the same in the test description string.
Attachment #8881003 - Flags: review?(bzbarsky) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ef997eeca061
Test non-existent pseudo-element styles. r=bz
https://hg.mozilla.org/mozilla-central/rev/ef997eeca061
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.