WebReflection / basicHTML

A NodeJS based, standard oriented, HTML implementation.
ISC License
126 stars 10 forks source link

Add support for HTMLUnknownElement #28

Closed SheepFromHeaven closed 5 years ago

SheepFromHeaven commented 5 years ago

The global scope is currently not populated with the HTMLUnknownElement interface.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLUnknownElement

It would be great to have this feature.

WebReflection commented 5 years ago

if you need it, I think you can just class HTMLUnknownElement extends HTMLElement {}, right?

'cause I don't see any relevant use case for that class in basicHTML, and this project purpose is not to be yet another jsdom.

SheepFromHeaven commented 5 years ago

@WebReflection basicHTML is recommended in the hyperHTML documentation. As we use it in our open source project, we wanted to test with basicHTML.

Our own inherited class of hyperHTMLElement checks before registering if it's already registered. see here for the code line: https://github.com/biotope/biotope-element/blob/master/src/register.ts#L6

In there we have a check for HTMLUnknownElement.

Should we test this with jsdom rather than basicHTML?

WebReflection commented 5 years ago

I see. No, it's fine then, but be aware that basicHTML will never return an HTMLUnknownElement instance, always an HTMLElement one.

I also don't think jsdom has custom Elements yet so you probably don't have much choices.

Fine

WebReflection commented 5 years ago

published as 0.20

WebReflection commented 5 years ago

P.S. interesting project there, seems very similar to HyperHTMLElement but hey, if that works for you, happy hyperHTML served well.

Also, thanks for the PR 👋

SheepFromHeaven commented 5 years ago

@WebReflection we use HyperHtmlElement in there and just enhance it 😄