wpt / css / css-cascade / revert-rule-layer.html

Status: PASS | Duration: 47ms | Subtests: 2/2 | Open test on wpt.live | wpt.fyi

Data from commit:
a50cb89 wpt: run reference-named files which are themselves tests (#836) (2026-09-03)

SubtestStatusMessage
The revert-rule keyword can cross layersPASS
The revert-rule does not unconditionally cross layersPASS

/css/css-cascade/revert-rule-layer.html

<!DOCTYPE html>
<title>The revert-rule keyword: interaction with @layer</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>
  @layer {
    #test1 {
      color: green;
    }
  }
  @layer {
    #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 cross layers');
</script>


<style>
  @layer {
    #test2 {
      color: red;
    }
  }
  @layer {
    #test2 {
      color: green;
    }
    #test2 {
      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 does not unconditionally cross layers');
</script>