wpt / css / css-cascade / scope-import-parent-pseudo.html

Status: FAIL | Duration: 45ms | Subtests: 0/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 & selector matches the scoping rootFAILassert_equals: expected "1" but got ""
The & selector behaves like :scopeFAILassert_equals: expected "1" but got ""

/css/css-cascade/scope-import-parent-pseudo.html

<!DOCTYPE html>
<title>@import scope(), '&' selectors</title>
<link rel="help" href="https://drafts.csswg.org/css-cascade-6/#at-import">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@import url("resources/scope-imported.css") scope((.scope));
</style>
<main id=main>
  <div class=scope>
    <div class=w>Inside</div>
    <div class=scope>
      <div class=w>Inner (W)</div>
      <div class=u>Inner (U)</div>
    </div>
  </div>
</main>
<script>
  test(() => {
    let e = main.querySelector('#main > .scope > .w');
    assert_equals(getComputedStyle(e).getPropertyValue('--w'), '1');
  }, 'The & selector matches the scoping root');

  test(() => {
    let w = main.querySelector('#main > .scope > .scope > .w');
    assert_equals(getComputedStyle(w).getPropertyValue('--w'), '1');
    // The '& > & > .u' selector should behave like ':scope > :scope > .u'
    // and therefore never match.
    let u = main.querySelector('#main > .scope > .scope > .u');
    assert_equals(getComputedStyle(u).getPropertyValue('--u'), '');
  }, 'The & selector behaves like :scope');
</script>