Commit 42fb60e
authored
fix: normalizer keeping empty src (#743)
# Summary
Now if no `src` attribute 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:
- on web, when you inserted an `<img>` with no `src` attribute, the
inline image would get dropped, whereas we want to still display the
placeholder
- on iOS and Android, the parser would break if passed an empty `src` or
no at all
## Test Plan
Set input's value with a `<img>` tag and a `src=""`, `src="something"
and no attribute at all. Each case should have the same effect - a
placeholder inline image.
## Screenshots / Videos
iOS
Before:
https://github.com/user-attachments/assets/5fbd6bf4-1170-497e-a539-45fdc7509111
After:
https://github.com/user-attachments/assets/b794d6d9-e3f1-4622-88e3-d677c32812da
## Compatibility
| OS | Implemented |
| ------- | :---------: |
| iOS | ✅ |
| Android | ✅ |
| Web | ✅ |
## Checklist
- [x] E2E tests are passing
- [ ] Required E2E tests have been added (if applicable)1 parent d389e5f commit 42fb60e
5 files changed
Lines changed: 21 additions & 3 deletions
File tree
- cpp
- parser
- tests
- ios/htmlParser
- src/web
- __tests__
- normalization
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
495 | 500 | | |
496 | 501 | | |
497 | 502 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
285 | 290 | | |
286 | 291 | | |
287 | 292 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
673 | | - | |
| 673 | + | |
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
265 | 273 | | |
266 | 274 | | |
267 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
0 commit comments