You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract and clone the contents then set the clone's data to a substring directly rather than through replace data. So even with cloning fixed, a processing instruction cut by a range keeps a map that doesn't match its shortened data.
I suggest running update attributes from data on the copy in all three places. The WebKit patch re-parses copies from their data, which amounts to the same thing. Copying the map instead would keep entries that setAttribute() added under names the pseudo-attribute grammar can't parse, such as $, but the range steps would still need to re-parse.
2. removeAttribute() rewrites data when the name isn't there
removeAttribute(name) always runs update data from attributes, even when the map has no entry for name. That re-serializes the data and queues a characterData mutation record, and data that doesn't parse as pseudo-attributes is lost:
Element's remove an attribute by name does nothing when the attribute is missing, and neither does toggleAttribute(name, false) on a processing instruction. I suggest returning early when this's attribute map[name] doesn't exist, which is what the WebKit patch does.
I suppose I could be convinced the other way too, but it seems like we need test coverage for this at a minimum.
@noamr can you write a test for the removeAttribute() case to confirm what the current behavior in Chromium is? I think we should make it a no-op, but if it isn't I can also review a Chromium CL to make it so.
@noamr can you write a test for the removeAttribute() case to confirm what the current behavior in Chromium is? I think we should make it a no-op, but if it isn't I can also review a Chromium CL to make it so.
Yea blink behavior is a no-op for removing non-existing attribute. I'll add a WPT.
Activity
Implement the ProcessingInstruction attribute API
foolip commentedon Oct 5, 2026
@noamr can you write a test for the
removeAttribute()case to confirm what the current behavior in Chromium is? I think we should make it a no-op, but if it isn't I can also review a Chromium CL to make it so.foolip commentedon Oct 5, 2026
Typo fix in #1506.
noamr commentedon Oct 5, 2026
Yea blink behavior is a no-op for removing non-existing attribute. I'll add a WPT.
Implement the ProcessingInstruction attribute API
Implement the ProcessingInstruction attribute API
Implement the ProcessingInstruction attribute API