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

[Spec] Incorrectly searches node data rather than rendered text #98

Open
bokand opened this issue Mar 13, 2020 · 2 comments
Open

[Spec] Incorrectly searches node data rather than rendered text #98

bokand opened this issue Mar 13, 2020 · 2 comments

Comments

@bokand
Copy link
Collaborator

bokand commented Mar 13, 2020

The find a range from a node list steps, which is the place in the spec where the actual string search is performed, uses the CharacterData of each node.

CharacterData is the raw data provided in the markup, e.g.:

<div>hello          world</div>

Will include all 10 spaces in CharacterData, even though they're collapsed into a single space when rendered.

The spec needs to specify exactly how we perform this collapsing.

@bokand bokand changed the title [Spec] Doesn't cover whitespace folding [Spec] Incorrectly searches node data rather than rendered text Nov 26, 2020
@zcorpan
Copy link

zcorpan commented Dec 7, 2023

Chromium currently seems to collapse whitespace both in generating a text fragment URL and when finding the target text. Demo: https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=12210#:~:text=foo%20bar,-Markup%20to%20test

@bokand
Copy link
Collaborator Author

bokand commented Dec 11, 2023

Yup, I noted in the discussion in #233 this was the intended behavior but I wasn't sure how to spec it correctly.

I think we want to preserve this behavior - e.g. an author changing the indentation level of an element (maybe because they added/removed an ancestor element) would break any links into that text (since the leading whitespace will change).

Lets use #233 to resolve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@zcorpan @bokand and others