WebReflection / WebReflection/linkedom

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

Open
#245 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2.1k
Forks
104
PR merge metrics
No merged PRs in 30d

Description

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);

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with document.createElement("div") and inspect the derived HTML element types listed under esm/html. Trace how the API currently constructs an Element, then verify that creating a div produces an instance of HTMLDivElement as shown in the issue's example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.