Skip to content

Update hashchange event to new structure#14515

Merged
Elchi3 merged 4 commits intomdn:mainfrom
Elchi3:weh-hashchange
Apr 4, 2022
Merged

Update hashchange event to new structure#14515
Elchi3 merged 4 commits intomdn:mainfrom
Elchi3:weh-hashchange

Conversation

@Elchi3
Copy link
Member

@Elchi3 Elchi3 commented Mar 31, 2022

This is a first attempt to reorganize content for WindowEventHandlers. It is using the hashchange event as an example.
BCD discussion that lead to this: mdn/browser-compat-data#15477

What this does:

  • Makes Window/hashchange_event the main page for the hashchange event
  • Updates Window/hashchange_event to the new format
  • Redirects windowEventHandlers/onhashchange to window/hashchange_event
  • Adds a section called "Event targets" to Window/hashchange_event mentioning the other 3 targets this event can be called on:
    • HTMLBodyElement
    • HTMLFrameSetElement
    • SVGSVGElement
  • Updates the interface pages HTMLBodyElement, HTMLFrameSetElement and SVGSVGElement to have an "Event handler" section that says there are events from Window available. (and removes the onhashchange event handler on these pages)

cc @teoli2003 and @queengooborg to take a look at this approach.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 31, 2022

Preview URLs

Flaws

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/API/HTMLFrameSetElement
Title: HTMLFrameSetElement
on GitHub
Flaw count: 4

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • /en-US/docs/Web/API/HTMLFrameSetElement/cols does not exist
    • /en-US/docs/Web/API/HTMLFrameSetElement/rows does not exist

URL: /en-US/docs/Web/API/WindowEventHandlers
Title: WindowEventHandlers
on GitHub
Flaw count: 7

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • /en-US/docs/Web/API/WindowEventHandlers/onoffline does not exist
    • /en-US/docs/Web/API/WindowEventHandlers/ononline does not exist
    • /en-US/docs/Web/API/WindowEventHandlers/onpagehide does not exist
    • and 1 more flaws omitted
  • bad_bcd_links:
    • no explanation!

URL: /en-US/docs/Web/API/HashChangeEvent
Title: HashChangeEvent
on GitHub
Flaw count: 2

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)

URL: /en-US/docs/Web/API/HTMLBodyElement
Title: HTMLBodyElement
on GitHub
Flaw count: 14

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • /en-US/docs/Web/API/HTMLBodyElement/aLink does not exist
    • /en-US/docs/Web/API/HTMLBodyElement/background does not exist
    • /en-US/docs/Web/API/HTMLBodyElement/bgColor does not exist
    • and 3 more flaws omitted
  • bad_bcd_links:
    • no explanation!
    • no explanation!
    • no explanation!
    • no explanation!
    • no explanation!
    • and 1 more flaws omitted

URL: /en-US/docs/Web/API/SVGSVGElement
Title: SVGSVGElement
on GitHub
Flaw count: 43

  • macros:
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • wrong xref macro used (consider changing which macro you use)
    • /en-US/docs/Web/API/SVGFitToViewBox does not exist
    • /en-US/docs/Web/API/SVGSVGElement/x does not exist
    • and 38 more flaws omitted

External URLs

URL: /en-US/docs/Web/API/Window/hashchange_event
Title: Window: hashchange event
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/HTMLFrameSetElement
Title: HTMLFrameSetElement
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/WindowEventHandlers
Title: WindowEventHandlers
on GitHub

No external URLs


URL: /en-US/docs/Web/API/HashChangeEvent
Title: HashChangeEvent
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/HTMLBodyElement
Title: HTMLBodyElement
on GitHub

No new external URLs


URL: /en-US/docs/Web/API/SVGSVGElement
Title: SVGSVGElement
on GitHub

No new external URLs

(this comment was updated 2022-04-04 14:15:04.103377)

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to improve the formulation, but maybe I'm too verbose now.

@Elchi3
Copy link
Member Author

Elchi3 commented Apr 4, 2022

I made another suggestion to advice the reader to use the window object for these events instead.

I believe in the HTML spec it is formulated like this.

Most of the time, the object that exposes an event handler is the same as the object on which the corresponding event listener is added. However, the body and frameset elements expose several event handlers that act upon the element's Window object, if one exists.

Copy link
Contributor

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this so this doesn't get stuck (even if not all changes have been committed yet)

@Elchi3 Elchi3 merged commit 67ee2ea into mdn:main Apr 4, 2022
@Elchi3 Elchi3 deleted the weh-hashchange branch April 4, 2022 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants