-
Notifications
You must be signed in to change notification settings - Fork 44
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
URL API #74
Comments
Additional consideration, given fragment directives always come after the hash should the following delete the fragment directives or should they be preserved?: const url = new URL('https://example.com/#:~:text=hello');
url.hash = ''; |
I agree this would be useful to add. I think modifying |
Seconded - I think something like add() would be useful so JS apps can easily construct these. On how What we landed on currently is a minimal change. The HTML Document loading steps will strip the fragment directive from the loaded URL. Otherwise URLs and locations behave exactly as today (e.g. adding a fragment directive to That said, I don't have any strongly held opinions here so I'm open to make changes to URL objects and |
Be removed. A fragment directive is a subset to fragment. For the other behavior to be reasonable, fragment directive needs to be independent of fragment (and probably a new name to denote this new addition to the URL standard). |
Closing out old issues Issues around how and when the URL is affected by the fragment directive are now well defined by #225. See https://wicg.github.io/scroll-to-text-fragment/#extracting-the-fragment-directive and the examples in that section for an overview. Re: having APIs to make it easier to work with (e.g. on URL), that still seems worth having but I think is out of scope for this repo and can be followed up in the HTML standards repo once this is upstream. |
While these text fragments will often be created by user agents it would be nice to be able to construct these easily in JS so that custom sharing options can be created.
For example Medium does this with selected text:
It would be nice to be able to do similar with fragment directives using the
URL
API.e.g. Example API surface:
The text was updated successfully, but these errors were encountered: