Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AbstractRange and StaticRange #589

Merged
merged 2 commits into from
Mar 16, 2018
Merged

Add AbstractRange and StaticRange #589

merged 2 commits into from
Mar 16, 2018

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 12, 2018

This refactors large parts of the DOM Standard to reclassify Range
objects as "live ranges" rather than "ranges". The bits shared
between StaticRange and Range objects are put on a shared superclass
named AbstractRange.

This also introduces a "collapsed" definition and uses it throughout.

It does not contain everything from
https://w3c.github.io/staticrange/. I based this draft on the IDL
present in implementations, coupled with the desire for a superclass.
Extensions beyond this seem best addressed as follow-ups.

Tests: ...


Preview | Diff

@annevk
Copy link
Member Author

annevk commented Mar 12, 2018

Given that there's no constructor I think the IDL test changes are sufficient. The other bits would need to be tested as part of https://w3c.github.io/input-events/index.html and other producers of these objects.

So this is ready to land after review.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things seem pretty good, although I wonder if there should be more explaining about how non-live ranges don't really obey the mental model you might expect? E.g. the note at https://whatpr.org/dom/589.html#boundary-points is not accurate for them, and https://whatpr.org/dom/589.html#introduction-to-dom-ranges might want to talk about a static range behaves or something, I dunno.

dom.bs Outdated
@@ -3650,7 +3605,7 @@ be initialized to null.

<h4 id=garbage-collection>Garbage collection</h4>

<a>Nodes</a> have a strong reference to
<a for=/>nodes</a> have a strong reference to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should stay uppercase

dom.bs Outdated
@@ -936,8 +936,8 @@ fields above, an <a>event listener</a> is a broader concept.
which takes an <a>event</a> <var>event</var>, and returns an {{EventTarget}} object. Unless
specified otherwise it returns null.

<p class="note no-backref"><a>Nodes</a>, <a for=/>shadow roots</a>, and <a>documents</a> override
the <a>get the parent</a> algorithm.
<p class="note no-backref"><a for=/>nodes</a>, <a for=/>shadow roots</a>, and <a>documents</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should stay upppercase

dom.bs Outdated
</ol>
<p>A <a for=/>node</a> is
<dfn export for="live range" id=partially-contained>partially contained</dfn> in a <a>live range</a>
if its an <a for=tree>inclusive ancestor</a> of the <a>live range</a>'s <a for=range>start node</a>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"its" should be "it is" here

dom.bs Outdated
@@ -9844,7 +9711,7 @@ These are the changes made to the features described in

{{Node}} now inherits from {{EventTarget}}.

<a>Nodes</a> are implicitly
<a for=/>nodes</a> are implicitly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should still be uppercase

dom.bs Outdated
@@ -8896,29 +8763,29 @@ these steps:
<ol>
<li>Let <var>s</var> be the empty string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole algorithm just says "start node" and "end node" a lot but should probably say "the context object's start node"/end node.

(Preexisting problem, though.)

This refactors large parts of the DOM Standard to reclassify Range
objects as "live ranges" rather than "ranges". The bits shared
between StaticRange and Range objects are put on a shared superclass
named AbstractRange.

This also introduces a "collapsed" definition and uses it throughout.

It does not contain everything from
https://w3c.github.io/staticrange/. I based this draft on the IDL
present in implementations, coupled with the desire for a superclass.
Extensions beyond this seem best addressed as follow-ups.

Tests: ...
@annevk annevk force-pushed the annevk/staticrange branch from b3b2950 to 627ccf1 Compare March 16, 2018 07:18
@annevk
Copy link
Member Author

annevk commented Mar 16, 2018

Yeah, I was thinking there should be more of an introduction at some point. But I'm not sure it makes much sense without the constructor as only input events can create these objects now and then I'd have to introduce those as well.

I have updated the note to be a little more specific.

annevk added a commit to web-platform-tests/wpt that referenced this pull request Mar 16, 2018
@annevk annevk merged commit 5f4249f into master Mar 16, 2018
@annevk annevk deleted the annevk/staticrange branch March 16, 2018 08:18
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Apr 15, 2018
…nge, a=testonly

Automatic update from web-platform-testsIDL update for AbstractRange and StaticRange

See whatwg/dom#589.

--
remove obsolete IDL test

wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967
wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967
@dstorey
Copy link
Member

dstorey commented May 10, 2018

I've just implemented this in Edge. It should be included in EdgeHTML 18

gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…nge, a=testonly

Automatic update from web-platform-testsIDL update for AbstractRange and StaticRange

See whatwg/dom#589.

--
remove obsolete IDL test

wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967
wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967

UltraBlame original commit: 88ae266890f10214842862a8c0a1f4f512a9f8e6
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
…nge, a=testonly

Automatic update from web-platform-testsIDL update for AbstractRange and StaticRange

See whatwg/dom#589.

--
remove obsolete IDL test

wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967
wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967

UltraBlame original commit: 88ae266890f10214842862a8c0a1f4f512a9f8e6
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
…nge, a=testonly

Automatic update from web-platform-testsIDL update for AbstractRange and StaticRange

See whatwg/dom#589.

--
remove obsolete IDL test

wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967
wpt-commits: 1c64b7e7f769ac7ab726f4738677168a95d13ab2, 359dac15b0ae6099d47708ff0d3efb8b5bb0db26
wpt-pr: 9967

UltraBlame original commit: 88ae266890f10214842862a8c0a1f4f512a9f8e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants