From c0071c7920d1459c54bc2673dcfd924a4a5f4eae Mon Sep 17 00:00:00 2001 From: Di Zhang Date: Mon, 30 Sep 2024 08:52:08 -0700 Subject: [PATCH] Change getComposedRanges() to take a dictionary Closes #176. --- index.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index cc5fa85..1a58c66 100644 --- a/index.html +++ b/index.html @@ -210,7 +210,7 @@

undefined removeRange(Range range); undefined removeAllRanges(); undefined empty(); - sequence<StaticRange> getComposedRanges(ShadowRoot... shadowRoots); + sequence<StaticRange> getComposedRanges(optional GetComposedRangesOptions options = {}); undefined collapse(Node? node, optional unsigned long offset = 0); undefined setPosition(Node? node, optional unsigned long offset = 0); undefined collapseToStart(); @@ -223,6 +223,10 @@

boolean containsNode(Node node, optional boolean allowPartialContainment = false); stringifier; }; + + dictionary GetComposedRangesOptions { + sequence<ShadowRoot> shadowRoots = []; + };
@@ -411,8 +415,9 @@

  • While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including - inclusive ancestor=] of any of shadowRoots, repeat these - steps: + inclusive ancestor=] of any of + options["{{GetComposedRangesOptions/shadowRoots}}"], + repeat these steps:
    1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=]. @@ -429,7 +434,9 @@

    2. While endNode is a [=node=], endNode's [=tree/root=] is a [=shadow root=], and endNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of - any of shadowRoots, repeat these steps: + any of + options["{{GetComposedRangesOptions/shadowRoots}}"], + repeat these steps:
      1. Set endOffset to [=tree/index=] of endNode's [=tree/root=]'s [=host=] plus 1.