wpt / css / css-nesting / nesting-revert-rule.html

Status: FAIL | Duration: 51ms | Subtests: 3/4 | Open test on wpt.live | wpt.fyi

Data from commit:
1884860 Copy-on-write style attribute blocks that are in the rule tree (#831) (2026-09-02)

SubtestStatusMessage
The revert-rule keyword can revert to a nested rulePASS
The revert-rule keyword can revert to a CSSNestedDeclarationsRulePASS
The revert-rule keyword can revert from a CSSNestedDeclarationsRulePASS
The revert-rule keyword can revert to scoped declarationsFAILassert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 0)"

/css/css-nesting/nesting-revert-rule.html

<!DOCTYPE html>
<title>The revert-rule keyword: interaction with nesting</title>
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#revert-rule-keyword">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
  :root {
    #test1 {
      color: green;
    }
    #test1 {
      color: red;
      color: revert-rule;
    }
  }
</style>
<div id=test1></div>
<script>
  test(() => {
    assert_true(CSS.supports('color:revert-rule'));
    assert_equals(getComputedStyle(test1).color, 'rgb(0, 128, 0)')
  }, 'The revert-rule keyword can revert to a nested rule');
</script>


<style>
  :root {
    #test2 {
      /* CSSNestedDeclarationsRule { */
        color: green;
      /* } */
      & {
        color: red;
        color: revert-rule;
      }
    }
  }
</style>
<div id=test2></div>
<script>
  test(() => {
    assert_true(CSS.supports('color:revert-rule'));
    assert_equals(getComputedStyle(test2).color, 'rgb(0, 128, 0)')
  }, 'The revert-rule keyword can revert to a CSSNestedDeclarationsRule');
</script>


<style>
  :root {
    #test3 {
      /* CSSNestedDeclarationsRule { */
        color: green;
      /* } */
      .something {}
      /* CSSNestedDeclarationsRule { */
        color: red;
        color: revert-rule;
      /* } */
    }
  }
</style>
<div id=test3></div>
<script>
  test(() => {
    assert_true(CSS.supports('color:revert-rule'));
    assert_equals(getComputedStyle(test3).color, 'rgb(0, 128, 0)')
  }, 'The revert-rule keyword can revert from a CSSNestedDeclarationsRule');
</script>


<style>
  @scope (#test4) {
    /* CSSNestedDeclarationsRule { */
      color: green;
    /* } */
  }

  #test4 {
    color: red;
    color: revert-rule;
  }
</style>
<div id=test4></div>
<script>
  test(() => {
    assert_true(CSS.supports('color:revert-rule'));
    assert_equals(getComputedStyle(test4).color, 'rgb(0, 128, 0)')
  }, 'The revert-rule keyword can revert to scoped declarations');
</script>