Skip to content

Selections work incorrectly when slot is removed from selected slotted element's parent #47121

Closed

Description

@webbedspace

Describe the bug:
See example. When a slotted element is removed from the shadow DOM by removing slot, its contents seemingly aren't removed from the selection.

To Reproduce:

<!doctype html>
<div id="Z"><template shadowrootmode=open>rooted1<slot name="a"></slot>rooted2<slot name="b"></slot>rooted3</template>
<span slot="a"><b id="X">slotted1</b>slotted2</span><span slot=b><i id="Y">slotted3</i></span></div>
<pre id="W"></pre>
<script>
    let s = getSelection()
    s.setBaseAndExtent(X,0,Y,1)
    X.parentNode.removeAttribute('slot');
    W.innerText = s+''
</script>

Firefox and Chrome
Image

Servo
Image

Platform:
Win 10

Activity

  1. added
    C-untriaged
    on Aug 10, 2026
  2. changed the title [-]Selection's `setBaseAndExtent()` works incorrectly when `slot` is removed from selected slotted element's parent[/-] [+]Selections work incorrectly when `slot` is removed from selected slotted element's parent[/+] on Aug 10, 2026
  3. added
    A-content/dom
    C-has-manual-testcase
    and removed
    C-untriaged
    on Aug 11, 2026
  4. added a commit that references this issue on Sep 11, 2026
    c4fbc94
  5. added a commit that references this issue on Oct 6, 2026
    5f5a074
  6. added a commit that references this issue on Oct 12, 2026
    f44e531
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/domC-has-manual-testcase

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions