fix: normalizer keeping empty src - #743
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the HTML normalization/parsing pipeline so <img> tags always carry a src attribute, defaulting to an empty value when missing, enabling consistent placeholder rendering and avoiding native parser breakage.
Changes:
- Web normalizer now emits
src=""for<img>whensrcis missing (or empty). - iOS parser regex updated to accept empty
srcvalues (src=""). - Added/updated unit tests in both web and C++ normalization paths to cover missing/empty
src.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/normalization/htmlNormalizer.ts | Ensures <img> always serializes with src="" when missing/empty. |
| src/web/tests/htmlNormalizer.test.ts | Adds test cases for <img> with missing src and src="". |
| ios/htmlParser/HtmlParser.mm | Allows src="" to be parsed by relaxing the src regex capture. |
| cpp/parser/GumboNormalizer.c | Emits src="" for <img> when src is missing/empty. |
| cpp/tests/GumboParserTest.cpp | Adds coverage for <img> normalization with missing/empty src. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hejsztynx
marked this pull request as ready for review
August 5, 2026 08:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Now if no
srcattribute is present inside<img>, the normalizer adds an empty one -src="". This is done for the sake of structural consistency, which also fixed a couple of issues:<img>with nosrcattribute, the inline image would get dropped, whereas we want to still display the placeholdersrcor no at allTest Plan
Set input's value with a
<img>tag and asrc="", `src="something" and no attribute at all. Each case should have the same effect - a placeholder inline image.Screenshots / Videos
iOS
Before:
Screen.Recording.2026-08-05.at.10.28.02.mov
After:
Screen.Recording.2026-08-05.at.10.36.36.mov
Compatibility
Checklist