GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(html): keep an end tag whose omission lets the adoption agency restructure the tree by aryanraj45 · Pull Request #21649 · webpack/webpack

Conversation

@aryanraj45

@aryanraj45 aryanraj45 commented Aug 9, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

§13.1.2.4 lets a paragraph or list-item end tag be omitted when nothing follows it in its parent, and the minifier took that permission at face value. Inside a formatting element it does not hold: the element left open is exactly the furthest block the adoption agency looks for when the parent's end tag arrives, so the page re-parses to a different tree — <b><p>x</p></b> printed as <b><p>x</b> re-parses to <b></b><p><b>x</b>. An em wrapping an li breaks the same way. Found by the real-browser DOM equivalence check while adding parser coverage cases.

The end tag is now kept when the parent is an HTML formatting element and the element itself is special. A div or ul parent is unaffected, and no existing snapshot in the suite changed.

What kind of change does this PR introduce?

fix

Did you add tests for your changes?

Yes — test/configCases/html/minimize-end-tag-in-formatting, covering both broken shapes plus two controls that must keep omitting. The fixture is also picked up by the browser equivalence unit test, which failed on it before the fix (11 vs 13 elements) and passes after.

Does this PR introduce a breaking change?

No. Output only grows where it was previously wrong.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

n/a

Use of AI

AI was used. I found the divergence through the browser equivalence check, then used AI to reduce it to a minimal reproduction, locate the rule in the printer, write the regression case and run the suites. I reviewed the change and verified the round-trip and the unaffected cases myself

Summary by CodeRabbit

  • Bug Fixes

    • Improved HTML output minification to preserve required end tags in formatting elements.
    • Prevented serialized HTML from being restructured incorrectly by browser parsing behavior.
  • Tests

    • Added coverage for end-tag minimization across paragraphs, list items, preserved blocks, and inline elements.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@aryanraj45
fix(html): keep an end tag whose omission lets the adoption agency re…
85d2390
…structure the tree

§13.1.2.4 lets a p or li end tag go when nothing follows it in its parent, but
inside a formatting element the element left open is exactly the furthest block
the adoption agency looks for on the parent's end tag: <b><p>x</p></b> printed
as <b><p>x</b> re-parses to a cloned <b> under the <p>. Keep the tag when the
parent is a formatting element and the element is special; div and ul are
unaffected.
@changeset-bot

changeset-bot Bot commented Aug 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 49a2be2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 1 package
Name Type
webpack Patch

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The HTML minimizer now preserves end tags for special elements nested directly inside formatting elements. This prevents adoption-agency tree restructuring from changing serialized output. A regression fixture covers paragraph, list-item, preserved block, and inline cases. The test configuration builds and minimizes the HTML, then snapshots the emitted page. The changeset documents the correction.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main HTML minification fix for adoption-agency tree restructuring.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Aug 9, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6e232c5-bbb8-4f58-a899-138b1d259379

📥 Commits

Reviewing files that changed from the base of the PR and between 267ef49 and 85d2390.

⛔ Files ignored due to path filters (2)
  • test/configCases/html/minimize-end-tag-in-formatting/__snapshots__/ConfigCacheTest.snap is excluded by !**/*.snap
  • test/configCases/html/minimize-end-tag-in-formatting/__snapshots__/ConfigTest.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • .changeset/157-html-minify-text-fixes.md
  • lib/html/syntax.js
  • test/configCases/html/minimize-end-tag-in-formatting/index.js
  • test/configCases/html/minimize-end-tag-in-formatting/page.html
  • test/configCases/html/minimize-end-tag-in-formatting/test.config.js
  • test/configCases/html/minimize-end-tag-in-formatting/webpack.config.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • webpack/schema-utils (auto-detected)
  • webpack/tapable (auto-detected)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .changeset/157-html-minify-text-fixes.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/html/syntax.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Aug 9, 2026

Copy link
Copy Markdown
Member

Please fix reviews

aryanraj45 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aryanraj45
fix(html): shorten the end-tag omission comment to two lines
49a2be2
@github-actions github-actions Bot added the area: html Experimental HTML support (lib/html) label Aug 9, 2026
@aryanraj45

aryanraj45 commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

@alexander-akait done shortened the comment to two lines please take a view thanks :))

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Aug 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.39%. Comparing base (d0a9320) to head (49a2be2).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21649      +/-   ##
==========================================
+ Coverage   94.23%   94.39%   +0.16%     
==========================================
  Files         628      628              
  Lines       79952    80279     +327     
  Branches    23676    23737      +61     
==========================================
+ Hits        75344    75783     +439     
+ Misses       4608     4496     -112     
Flag Coverage Δ
css-parsing 25.88% <ø> (-0.06%) ⬇️
html5lib 30.28% <100.00%> (+2.91%) ⬆️
integration 88.74% <80.00%> (-0.10%) ⬇️
test262 49.08% <ø> (-0.08%) ⬇️
unit 52.22% <80.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codspeed

codspeed Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 33.43%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 218 untouched benchmarks

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Memory benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 397.6 KB 274.8 KB +44.67%
⚡ Memory benchmark "future-defaults", scenario '{"name":"mode-production","mode":"production"}' 10.5 MB 8.5 MB +23.07%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing aryanraj45:fix/html-end-tag-in-formatting-parent (49a2be2) with main (6412396)

Open in CodSpeed
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 10, 2026
perf(html): stream the SourceProcessor walk and recycle completed subtrees #21595
Merged
@alexander-akait
alexander-akait merged commit 57f2f2e into webpack:main Aug 10, 2026
103 of 105 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (57f2f2e).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@57f2f2e
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@57f2f2e
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@57f2f2e
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Aug 10, 2026
feat: configure or exclude each asset type's minifier via optimization.minimize #21663
Merged
feat(html): add optimization.minimize.html.tagOmission #21677
Closed
feat(html): add optimization.minimize.html.tagOmission #21678
Closed
fix(html): read past the whitespace collapseWhitespace removes when omitting an end tag #21694
Closed
feat(html): leave out the implied <html> tag, and align the minify option surface #21700
Merged
feat(html): minify svg, standalone and inside css #21714
Closed
fix(html): drop a shell tag kept for whitespace that prints nothing, and respell escaped quotes #21717
Merged
added <li> to P_FOLLOWED_BY #21735
Closed
fix(html): keep the end tags the parser cannot put back, and mirror <selectedcontent> as an engine does #21743
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Aug 20, 2026
fix: only make CSS and HTML transformations an engine cannot tell apart #21774
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area: html Experimental HTML support (lib/html)

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@aryanraj45 @alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.