WICG / scroll-to-text-fragment

Proposal to allow specifying a text snippet in a URL fragment
Other
589 stars 42 forks source link

Fix advancement in 'Next non-whitespace position'. #192

Closed bokand closed 2 years ago

bokand commented 2 years ago

These steps didn't consider the case where they're run on a range whose start is already at the end of its node.

Moving the node advancement step to the start of the loop fixes this.

Also consolidate the node advancement for various cases into a single check. Previously the non-searchable subtree case would advance by 'next node that isn’t a shadow-including descendant of node' which is now omitted in the generalized case. However, this is equivalent since if the next node is a shadow-including descendant of node, it must also be in a non-searchable subtree and so it will keep advancing until it is no longer a descendant of node.

Fixes #189


Preview | Diff

bokand commented 2 years ago

@megangardner PTAL, I simplified the advancement a bit which I think should be equivalent modulo fixing the issue in #189

bokand commented 2 years ago

@megangardner friendly ping

bokand commented 2 years ago

I went ahead and merged this since it's small but PLMK if you find an issue.