wpt / css / css-anchor-position / pseudo-element-with-slotted-anchor.html

Status: FAIL | Duration: 16ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-anchor-position/pseudo-element-with-slotted-anchor.html

<!DOCTYPE html>
<title>Slotted anchor with anchored pseudo-element</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#target-anchor-element">
<link rel="match" href="pseudo-element-with-slotted-anchor-ref.html">
<my-anchor>
  <template shadowrootmode="open">
    <style>
    :host {
      display: block;
    }

    ::slotted(*) {
      display: block;
      anchor-name: --anchor;
      padding: 2rem;
      background: red;
      color: white;
      inline-size: fit-content;
    }

    :host::after {
      content: 'target';
      position: absolute;
      position-anchor: --anchor;
      position-area: bottom center;
      background: lightblue;
      padding: 1rem;
    }
    </style>
    <slot></slot>
  </template>
  <span>anchor</span>
</my-anchor>

/css/css-anchor-position/pseudo-element-with-slotted-anchor-ref.html

<!DOCTYPE html>
<style>
my-anchor {
  display: block;
}

span {
  display: block;
  anchor-name: --anchor;
  padding: 2rem;
  background: red;
  color: white;
  inline-size: fit-content;
}

my-anchor::after {
  content: 'target';
  position: absolute;
  position-anchor: --anchor;
  position-area: bottom center;
  background: lightblue;
  padding: 1rem;
}
</style>
<my-anchor>
  <span>anchor</span>
</my-anchor>