Description
@Spongman highlights in #3155 that there is a confusion between the properties .elt
and .canvas
causing us to write defensive code like so:
p5.js/src/core/p5.Renderer2D.js
Line 112 in 5a46133
What is the purpose of having both .elt
and .canvas
? How can it be that the canvas should sometimes come from .elt
and sometimes from .canvas
?
Searching for .canvas =
I get these results:
Line 2637 in 5a46133
Line 29 in 5a46133
Line 26 in 5a46133
Line 144 in 5a46133
p5.js/src/webgl/p5.RendererGL.js
Line 176 in 5a46133
Searching for
.elt =
I get these results:Line 44 in 5a46133
Line 585 in 5a46133
Line 723 in 5a46133
and a comment about checking if the canvas is associated with the p5 instance
Lines 1938 to 1939 in 5a46133
Some of the places that assign canvas also assign elt afterwards, some do not.
In #3155 @Spongman solves the problem via if (!this.canvas) this.loadPixels();
, is that a general approach we should apply elsewhere?
Do we have a place where we can add (or already have?) YUIDocs for .elt
and .canvas
?
Metadata
Metadata
Assignees
Type
Projects
Status