wpt / css / selectors / visited-in-visited-compound.html

Status: PASS | Duration: 7ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/selectors/visited-in-visited-compound.html

<!DOCTYPE html>
<title>Behavior of :visited with a compound subject selector</title>
<!--
  Note: this test is intentionally not specific about the exact expected
  result, since the exact behavior is not specified well at the moment.
  As long as a#inner and #inner (see -ref.html) behaves the same way
  for the same DOM, we consider that a pass.
-->
<link rel="help" href="https://drafts.csswg.org/selectors/#visited-pseudo">
<link rel="match" href="visited-in-visited-compound-ref.html">
<style>
  :visited > a#inner { color: red; }
</style>
<a href="" id=outer>Visited1</a>
<script>
  window.onload = () => {
    // Use script, since the parser can't produce this.
    let inner = document.createElement('a');
    inner.setAttribute('href', '');
    inner.setAttribute('id', 'inner');
    inner.textContent = 'Visited2';
    outer.append(inner);
  }
</script>

/css/selectors/visited-in-visited-compound-ref.html

<!DOCTYPE html>
<title>Behavior of :visited with a compound subject selector (ref)</title>
<style>
  :visited > #inner { color: red; }
</style>
<a href="" id=outer>Visited1</a>
<script>
  window.onload = () => {
    // Use script, since the parser can't produce this.
    let inner = document.createElement('a');
    inner.setAttribute('href', '');
    inner.setAttribute('id', 'inner');
    inner.textContent = 'Visited2';
    outer.append(inner);
  }
</script>