-
Notifications
You must be signed in to change notification settings - Fork 34
Description
It is my understanding that the only way to produce a value with type CanvasElement is to use getCanvasElementById. This forces use of an HTML id, but there are ways to access HTML elements without them having an id (i.e. with getHTMLElementRef in Halogen, for instance).
It would be nice to have a function fromElement :: HTMLElement -> Maybe CanvasElement (or HTMLElement -> Maybe CanvasElement).*
Doing away with the need for HTML IDs reduces the risk of collision between e.g. canvases from two instances of the same Halogen component.
* HTMLElement is defined here: https://pursuit.purescript.org/packages/purescript-web-html/4.1.0/docs/Web.HTML.HTMLElement#t:HTMLElement
Element is defined here: https://pursuit.purescript.org/packages/purescript-web-dom/6.0.0/docs/Web.DOM.Internal.Types#t:Element