mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.13k stars 22.45k forks source link

Unnecessary / Inconsistent use of window. #27666

Open blindman67 opened 1 year ago

blindman67 commented 1 year ago

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations

What specific section or headline is this issue about?

First two code examples

What information was incorrect, unhelpful, or incomplete?

The calls to window.requestAnimationFrame(draw);

in the first sample and window.requestAnimationFrame(clock);

in the second sample inconsistently use the window reference when using DOM API's

What did you expect to see?

I expected not to see the reference to window requestAnimationFrame(draw); and requestAnimationFrame(clock); in the second sample

Do you have any supporting links, references, or citations?

The last sample is consistent with the implied use of window.

It shows consistent reference via implied window as follows requestAnimationFrame(anim)

As do all samples showing implied window reference for document rather than window.document

Do you have anything more you want to share?

Maybe a second issue? The first sample uses Date to get a time to used to animate content rather than use the time parameter (not defined in the sample) passed to the requestAnimationFrame callback.

MDN metadata

Page report details * Folder: `en-us/web/api/canvas_api/tutorial/basic_animations` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/canvas_api/tutorial/basic_animations/index.md * Last commit: https://github.com/mdn/content/commit/db59cf229e24aae0fb316a838080490818b66ac6 * Document last modified: 2023-02-20T09:57:49.000Z
Josh-Cena commented 2 months ago

=> https://github.com/orgs/mdn/discussions/710