b-fuze / deno-dom

Browser DOM & HTML parser in Deno
https://jsr.io/@b-fuze/deno-dom
MIT License
423 stars 47 forks source link

Add HTMLUnknownElement #136

Open BlackAsLight opened 1 year ago

BlackAsLight commented 1 year ago

I'm trying to figure out if the HTMLElement, or Element in this case, returned from document.createElement is a valid HTML tag. At first the internet suggested I stringify the tag as in the browser the string ends up being [object HTMLUnknownElement] for any invalid Element created, but this doesn't seem to work with deno-dom as it seems to get stringified to [object EventTarget] instead. The next suggestion I found was to try tag instanceof HTMLUnknownElement which does also work in the browser, but from what I can see in the documentation, isn't available here.

If you know of another way to validate weather an Element is a valid HTML tag then I'm all ears, but otherwise I'm asking if you could add support for this.

b-fuze commented 1 year ago

Yeah, this is a known issue. It basically depends on #128, #73 (and by extension #81), and #4. I need to find some time to implement those so that Deno DOM doesn't see everything as just an Element