servo / servo/html5ever

Invalid HTML produces duplicated elements

Open
#588 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.6k
Forks
288
Avg merge
2d 22h
Merged PRs (30d)
8

Description

The following invalid HTML:

<html>
        <body>
        <div class="tb nb"><a href="https://www.humanw.tu-darmstadt.de/fachbereich/index.de.jspZur Homepage des Fachbereichs.</a><br></div>
	<div class="tb" >
    </div>
    </body>
    </html>

produces duplicate elements when parsing with rcdom:

     Running `/home/moritz/Documents/html5ever/target/debug/examples/print-rcdom`
#Document
    <html>
        <head>
        <body>
            #text: \n        
            <div class="tb nb">
                <a href="https://www.humanw.tu-darmstadt.de/fachbereich/index.de.jspZur Homepage des Fachbereichs.</a><br></div>
        <div class=" tb"="">
                    #text: \n    
            <a href="https://www.humanw.tu-darmstadt.de/fachbereich/index.de.jspZur Homepage des Fachbereichs.</a><br></div>
        <div class=" tb"="">
                #text: \n    \n    \n

Parse errors:
    Unexpected token
    Bad character
    Bad character
    Unexpected open element
    Unexpected open tag at end of body

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

Reproduce the report with the malformed HTML and the rcdom print-rcdom example mentioned in the issue. Trace how the parser constructs the duplicated elements and malformed class attribute, then verify that the resulting document tree contains only the intended elements while retaining the reported parse errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, rust
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.