Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define
analytics
in the global context to guard against `id="analyt…
…ics"`. This defines `analytics` in the global context to guard against HTML elements on the page potentially named "analytics". This is necessary because we now have some docs pages with elements using `id="analytics"`. Unfortunately, due to a historical artifact in web-browser history it was once made possible to access HTML elements, from JavaScript, by their ID on the `window` object: window["some-div-id"] Unfortunately, Segment.io uses a JavaScript variable named `analytics`, and it's not possible to `push` stats into an HTML DIV which happens to also be named `analytics` and have those stats work. :) Of course, it's best to use the facilities that were actually designed for that, like `document.getElementById`, but historical reasons have caused this `window` access technique to still be the behavior for modern browsers. Ref: https://github.com/apollographql/engine-docs/pull/135 Ref: https://github.com/apollographql/engine-docs/commit/acd4a8e5 Ref: https://github.com/apollographql/engine-docs/blame/ec045186/source/index.md#L21 https://w3c.github.io/html/browsers.html#named-access-on-the-window-object.
- Loading branch information