Change canvas id to myCanvas in Path2D examples (Fixes #42155)
Description
This PR updates the <canvas> element ID used in the Path2D examples.
The previous examples used id="canvas", which can lead beginners to accidentally use a non-canvas element with the same ID, resulting in the common error:
getContext is not a function
The examples now consistently use id="myCanvas".
Motivation
Using a more specific and less generic ID helps prevent confusion for new developers.
It avoids accidental misuse of <div id="canvas"> and improves the clarity and reliability of the example code.
Additional details
- Updated the HTML
<canvas>ID in both examples. - Updated corresponding JavaScript
getElementById()calls.
Related issues and pull requests
Fixes #42155
There are hundreds of these... should we try to fix them all? There doesn't seem to be a whole lot of point in just fixing one, if we think this is a big enough problem to be worth fixing at all.
Personally +1 that this is a problem. It's not immediately obvious where getContext comes from since we are not documenting the canvas element itself. Even just unhiding the HTML code goes a long way.
There's 101 such cases: https://github.com/search?q=%22%3Ccanvas+id%3D%5C%22canvas%5C%22%22+org%3Amdn&type=code&ref=advsearch