When I create a new Renderer by specifying the canvas property and leaving the element property empty, I get a warning saying:
Matter.js: Render.create: options.element was undefined, render.canvas was created but not appended
As far as I'm concerned, I do not see why we would specify element if we are already telling it the canvas to use.
Looking at the code, it always prints if no element is provided. Also, if you have canvas AND element, it will be moved from it's original location to a child of the element (perhaps this is desired?).
The simple fix is to have a flag if render.canvas was provided and don't log if it was - but perhaps the "element" and "canvas" could be merged into just "element". If element is a canvas element, it is used in place - otherwise a new canvas is created and appended as a child of element. Though then this would be an API change.
but perhaps the "element" and "canvas" could be merged into just "element". If element is a canvas element, it is used in place - otherwise a new canvas is created and appended as a child of element. Though then this would be an API change.
This makes sense!
I think the error message was in there because some people were confused, but maybe I should review this if I can think of a way to avoid any breaking API change.
As far as I can tell, this has been fixed in edge release (0.14.1). Therefore, I'm going to close this issue. Thanks!
Most helpful comment
As far as I can tell, this has been fixed in edge release (0.14.1). Therefore, I'm going to close this issue. Thanks!