Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c7b3ebaa936a6c3cb28974d1f8b2f64c2c99d5ad
      
https://github.com/WebKit/WebKit/commit/c7b3ebaa936a6c3cb28974d1f8b2f64c2c99d5ad
  Author: Razvan Caliman <[email protected]>
  Date:   2026-04-21 (Tue, 21 Apr 2026)

  Changed paths:
    M Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

  Log Message:
  -----------
  Web Inspector: Elements: Editing an attribute value that contains double 
quotes results in a malformed value
https://bugs.webkit.org/show_bug.cgi?id=312465
rdar://149523483

Reviewed by Devin Rousso.

Attributes in the Elements DOM tree outline are rendered by wrapping the value 
in double quotes
(`WI.DOMTreeElement.prototype._buildAttributeDOM()`).

Entering editing mode turns the `<span`> element containing the represented 
attribute
into a `contenteditable=plaintext` element. (`WI.startEditing()`).

When committing the changed value, the `textContent` of this editable element
is sent to the backend as a text string 
(`target.DOMAgent.setAttributesAsText()`)
which interpolates the string into a dummy element to parse the result and 
update the node.
(`InspectorDOMAgent::setAttributesAsText()`). This is done to handle cases where
the committed value contains additional attributes, not just a single changed 
attribute.

If the changed attribute value contains double quotes, these conflict with the 
double quotes used to wrap the value in the DOM tree outline.
Web Inspector does not use the same type of quotes as in the original HTML 
markup.

For example, markup like `style='filter: url("#glow")'`, is rendered and 
offered for editing
as `style="filter: url("#glow")"` and committed as `style=\"filter: 
url(\"#glow\")\"`.

The interpolation on the backend results in a malformed string
that causes the HTML parser to break the value at double quote limits.

This patch changes the type of quotes used in Web Inspector DOM tree outline to 
represent
the attribute if the attribute value already contains double quotes.

* Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype._buildAttributeDOM):

Canonical link: https://commits.webkit.org/311717@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to