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

Behavior or ZeroWidthSpace #253

Open
ktangri opened this issue Jan 29, 2024 · 4 comments
Open

Behavior or ZeroWidthSpace #253

ktangri opened this issue Jan 29, 2024 · 4 comments

Comments

@ktangri
Copy link

ktangri commented Jan 29, 2024

The documentation for scrolling to text fragment mentions that whitespace is ignored and I see explicit mention of how &nbsp characters are handled. However, I do not see any mention of how &ZeroWidthSpace is handled nor can I seem to link a text fragment that has &ZeroWidthSpace as a prefix.

Below is what I am trying to match with (what I think) is the relevant information extracted. I want to match the 2,806 (appears multiple times with the same suffix so requires a prefix).

<table>
    <tbody>
        <tr>
            <td>...</td>
            ...
            <td><ix:nonfraction>66.05</ix:nonfraction></td>
            <td><em>&nbsp</em></td>
        </tr>
        <tr>
            <td><p>&ZeroWidthSpace</p></td>
            <td><em>&nbsp</em></td>
            <td><em>&nbsp</em></td>
            <td><ix:nonfraction>2,806</ix:nonfraction></td>
            ...
        </tr>
    </tbody>
</table>

What I've Tried:

  • Ignoring the ZeroWidthSpace and using the preceding text as a prefix (66.05-)
  • Percent encoding the ZeroWidthSpace and using that as a prefix (%e2%80%8b-)

Is there something I am missing here? What is the expected behavior of ZeroWidthSpace?

@bokand
Copy link
Collaborator

bokand commented Jan 31, 2024

Thanks for filing. I don't think we've explicitly covered it and this results on some edge-cases...

From what I can tell a zwsp is collapsed along with other whitespace in matching so text=foo will match "f​oo" but it isn't treated as whitespace when looking for context so text=f-,oo will fail.

The intent is that it should be treated as whitespace in both contexts so this is a bug.

(Note: see also #250 - I'll try to address these together)

@ktangri
Copy link
Author

ktangri commented Feb 1, 2024

Appreciate the confirmation! Just to clarify - after you make any necessary changes, browsers will still need to update their versions of this in order for it to be supported right?

@bokand
Copy link
Collaborator

bokand commented Feb 1, 2024

Yes, that's right. I haven't tried to see what Safari does yet, does it behave similarly?

@ktangri
Copy link
Author

ktangri commented Feb 1, 2024

Just confirmed that Safari (similar to Chrome) does not ignore the zwsp when trying to match text=66.05-,2%2C806

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

No branches or pull requests

2 participants