If you have a Razor page with a DOM element (such as an HTMLCanvasElement), you can get an ElementReference to it using @ref. This may be useful to pass to JavaScript interop, for example you could pass this reference to an interop library that calls canvas context drawing commands, handing the ElementReference to JS so it can act upon the DOM object.
Now suppose you want to do the same, but with a dynamically created in-memory HTMLCanvasElement. So it will not exist on a Razor page, and will not have a @ref, but you might want to (from C#) call some drawing commands on it.
So the question is: Is it possible to create an in-memory DOM element in JS or C#, and get an ElementReference to it, or equivalent?
(Note there are ways around my specific problem, e.g. write the C# to JS interop so that it doesn't need a Canvas reference, but instead uses a unique identifier, but I think this question has worth in the general case, if an answer exists.)