Skip to content

fix(html): the base address comes from insertion order, not tree order #287

Closed

Description

@tobocop2

The raw-text scan that picks the page's base address (crates/crawlberg/src/html/start_tags.rs, after #232) takes the first <base href> in the order the tree builder places elements, not the first in tree order, and a <base> inside content that <frameset> removes still counts. For <table><tr><td><base href="/1"></td><base href="/2"></tr></table> the scan picks /1, and a browser picks /2. This is older than #232 and rare; the old scanner mismatched about 100 times as often.

Fix

Pick the base from the finished tree (the first <base> element with an href in tree order that is still in the document), not from the order elements were inserted.

Activity

  1. self-assigned this
    on Sep 26, 2026
  2. added
    correctness
    P2
    bug
    on Sep 27, 2026
  3. added theissue type on Sep 27, 2026
  4. added 2 commits that reference this issue on Sep 27, 2026
    6f1dd6f
    af55b10
  5. added
    P3
    and removed
    P2
    on Sep 27, 2026
  6. added a commit that references this issue on Sep 29, 2026
    31734de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3bugcorrectness

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions