WebReflection / WebReflection/linkedom
[bug] document shortcut element properties lose their children
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.1k
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
What happened
@WebReflection the following test case in Jest:
it('should be the same <body /> element', () => {
const { document } = parseHTML(`<body><div class="whatever"></div></body>`);
const body = document.querySelector('body'),
expect(body).toBe(document.body);
});
outputs this kind of result:
- Expected - 0
+ Received + 6
+ <body>
+ <head />
<body />
+ <div
+ class="whatever"
+ />
+ </body>
Real world
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported Jest case using parseHTML with a body containing a div, then inspect how document.body and the body shortcut element are constructed. Trace the shortcut element's child handling and verify that document.querySelector('body') is identical to document.body while preserving the head and div children.
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