WebReflection / linkedom

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

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

Open Havunen opened 1 year ago

Havunen commented 1 year 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 1 year ago

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