Intent to Ship: Move location.fragmentDirective to document.fragmentDirective

135 views
Skip to first unread message

David Bokan

unread,
Aug 6, 2020, 3:59:46 PM8/6/20
to blink-dev

***This is a minor change to the already shipped (in M80) text-fragment feature. I followed the chromestatus intent template which asks for many links - where not specific or relevant to this change I point at the general text-fragment feature.***


Contact emails

bo...@chromium.org

Explainer

https://crbug.com/1057795
https://github.com/whatwg/html/issues/5523

Specification

https://wicg.github.io/scroll-to-text-fragment/#feature-detectability

Design docs

https://github.com/WICG/scroll-to-text-fragment/

TAG review

https://github.com/w3ctag/design-reviews/issues/392

Summary

This is a small change to the text-fragments feature in https://chromestatus.com/feature/4733392803332096. The above introduced an empty object at `window.location.fragmentDirective` as a means to feature detect the newly added text-fragment capability. `window.location` turns out to be a bad place for this functionality, see https://crbug.com/1057795This change moves `window.location.fragmentDirective` to `document.fragmentDirective` which seems like a more appropriate and safer place.

Link to “Intent to Prototype” blink-dev discussion

https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/aKI6doxffgQ/7dzrVvo4CAAJ

Risks



Interoperability and Compatibility

Chromium is the only currently implementation of text-fragments so the interop risk is low. 

There is some compat risk that there are existing users of `window.location.fragmentDirective`, though this was only recently added in M80.

We added a use counter: https://chromestatus.com/metrics/feature/timeline/popularity/3283. This shows ~2% of page loads reading the field which seems high. An analysis of HTTPArchive shows ~4000 domains that read location.fragmentDirective: https://docs.google.com/spreadsheets/d/1WxHFozsnA4qwfbVdt0iKbuUyJfu6Z9aKdjqEC6sSGf4/edit?usp=sharing All these uses seem to be 2 analytics scripts from PayPal and PerimiterX that use it for user agent detection. Removing location.fragmentDirective doesn't appear to have a user visible effect on the page.

Gecko: No signal
WebKit: No signal
Web developers: No signals


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes https://wpt.fyi/results/scroll-to-text-fragment/scroll-to-text-fragment-api.html?label=experimental&label=master&aligned

Tracking bug

https://crbug.com/1057795

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5679640498667520

This intent message was generated by Chrome Platform Status.

Yoav Weiss

unread,
Aug 8, 2020, 5:25:43 PM8/8/20
to David Bokan, blink-dev
LGTM1

This seems like a minor change required for compat, so better to go ahead with it now rather than later.
Please make sure that the public documentation of the feature and its detection (e.g. MDN, web.dev) is also changed to reflect the new feature detection method.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CANMmsAvFqGbEeiHiRTQLpNymOMUoJ%2B21nUJsPNt6AMJtnd3h0w%40mail.gmail.com.

Thomas Steiner

unread,
Aug 8, 2020, 6:56:01 PM8/8/20
to Yoav Weiss, David Bokan, blink-dev
On Sat 8. Aug 2020 at 23:25 Yoav Weiss <yo...@yoav.ws> wrote:
LGTM1

This seems like a minor change required for compat, so better to go ahead with it now rather than later.
Please make sure that the public documentation of the feature and its detection (e.g. MDN, web.dev) is also changed to reflect the new feature detection method.

--
Thomas Steiner, PhD—Developer Advocate (https://blog.tomayac.com, https://twitter.com/tomayac)

Google Germany GmbH, ABC-Str. 19, 20354 Hamburg, Germany
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.1.23 (GNU/Linux)

iFy0uwAntT0bE3xtRa5AfeCheCkthAtTh3reSabiGbl0ck0fjumBl3DCharaCTersAttH3b0ttom.hTtPs://xKcd.cOm/1181/
-----END PGP SIGNATURE-----

jd66...@gmail.com

unread,
Aug 10, 2020, 5:56:54 PM8/10/20
to blink-dev
Enter code here...

Mike West

unread,
Aug 14, 2020, 5:34:11 AM8/14/20
to blink-dev, jd66...@gmail.com
LGTM2.
Message has been deleted

David Bokan

unread,
Aug 18, 2020, 3:11:19 PM8/18/20
to blink-dev, jd66...@gmail.com
Friendly ping. Still waiting on a third stamp here (and trying to make M86 cut this week)

Chris Harrelson

unread,
Aug 18, 2020, 3:56:03 PM8/18/20
to David Bokan, blink-dev, jd66...@gmail.com
LGTM3

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Thomas Steiner

unread,
Sep 2, 2020, 7:20:20 AM9/2/20
to Chris Harrelson, David Bokan, blink-dev, jd66...@gmail.com
Now that this has landed, I have noticed that `window.FragmentDirective` (upper case 'F') is exposed, too, apart from `document.fragmentDirective` (before and after this shipment). Is this on purpose?

David Bokan

unread,
Sep 2, 2020, 10:00:22 AM9/2/20
to Thomas Steiner, Chris Harrelson, blink-dev, jd66...@gmail.com
I think so, yes, and that's unchanged from before. `FragmentDirective` is the type for the object returned from `document.fragmentDirective`. I guess it gets added to the global object. This is consistent with other types, e.g. `window.Location`.

Thomas Steiner

unread,
Sep 2, 2020, 10:19:25 AM9/2/20
to David Bokan, Thomas Steiner, Chris Harrelson, blink-dev, jd66...@gmail.com
On Wed, Sep 2, 2020 at 4:00 PM David Bokan <bo...@google.com> wrote:
I think so, yes, and that's unchanged from before. `FragmentDirective` is the type for the object returned from `document.fragmentDirective`. I guess it gets added to the global object. This is consistent with other types, e.g. `window.Location`.

Sounds good, thanks! For feature detection, it's probably still better to look for `document.fragmentDirective`. 

jacob duncan

unread,
Sep 24, 2020, 5:20:23 PM9/24/20
to Thomas Steiner, David Bokan, Chris Harrelson, blink-dev
Reply all
Reply to author
Forward
0 new messages