WebReflection / linkedom

A triple-linked lists based DOM implementation.
https://webreflection.medium.com/linkedom-a-jsdom-alternative-53dd8f699311
ISC License
1.62k stars 78 forks source link

[BUG] document.createElement() API should create matching derived type of html element #245

Open Havunen opened 9 months ago

Havunen commented 9 months ago

Currently when using document.createElement("div") it creates instance of Element class where tag name equals "div". However Linkedom has all these https://github.com/WebReflection/linkedom/tree/main/esm/html derived types defined in the library but they are not actually used when creating instances of html nodes through JS API.

This feature should make following code pass

var dom = document.createElement("div");

expect(dom instanceof HTMLDivElement).toEqual(true);
Havunen commented 9 months ago

I changed type of this issue to BUG because I noticed it works just like for some tags but not for all