Commit 04b4c81
committed
Fix duplicate attribute removal in WP_HTML_Template
When using false/null to remove a placeholder attribute, duplicate
attributes (e.g., `<input disabled="</%d>" disabled>`) now get removed
as well.
The fix pre-computes duplicate removal edits in compile(), following
the existing pattern for text normalization and attribute escaping.
This is more efficient than waiting for normalize() to strip them at
render time, and correctly handles the case where removing the first
attribute would leave the duplicate as the primary attribute.
Changes:
- Make duplicate_attributes protected in WP_HTML_Tag_Processor
- Expose get_duplicate_attributes() in Template's anonymous class
- Emit removal edits for all duplicates in compile()1 parent 245f24a commit 04b4c81
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | | - | |
| 721 | + | |
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
145 | 149 | | |
146 | 150 | | |
147 | 151 | | |
| |||
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
317 | 335 | | |
318 | 336 | | |
319 | 337 | | |
| |||
0 commit comments