Open bokand opened 4 years ago
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
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.
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.:
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.