Bug 139623 - Web Inspector: Empty attribute added to a DOM tree outline element should not add whitespace within the tag
Summary: Web Inspector: Empty attribute added to a DOM tree outline element should not...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
Keywords: InRadar
Depends on:
Reported: 2014-12-13 10:39 PST by Brian Burg
Modified: 2017-03-18 17:58 PDT (History)
5 users (show)

See Also:

Patch (1.52 KB, patch)
2017-03-16 18:54 PDT, Devin Rousso
bburg: review+
Details | Formatted Diff | Diff
Patch (1.38 KB, patch)
2017-03-18 17:17 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Burg 2014-12-13 10:39:26 PST
Steps to reproduce:

1. Click on a DOM element in the DOM tree with no attributes
2. <enter> to start editing
3. <enter> again to commit the edit

This adds an empty attribute to the UI, even though the attribute is never added in the backend.

If you instead add multiple spaces between steps 2 and 3, the edit is aborted and no extra space is added in the tag (presumably, this is because the backend rejected the change).

This is similar to https://bugs.webkit.org/show_bug.cgi?id=111036.
Comment 1 Radar WebKit Bug Importer 2014-12-17 11:24:06 PST
Comment 2 Devin Rousso 2017-03-16 18:54:18 PDT
Created attachment 304738 [details]
Comment 3 Nikita Vasilyev 2017-03-18 16:25:56 PDT
Comment on attachment 304738 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=304738&action=review

> Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:984
> +        if (!newText.trim().length)

if (!newText.trim())

An empty string is already a falsy value.
Comment 4 Brian Burg 2017-03-18 17:07:23 PDT
Comment on attachment 304738 [details]

Comment 5 Devin Rousso 2017-03-18 17:17:09 PDT
Created attachment 304888 [details]
Comment 6 WebKit Commit Bot 2017-03-18 17:58:23 PDT
Comment on attachment 304888 [details]

Clearing flags on attachment: 304888

Committed r214141: <http://trac.webkit.org/changeset/214141>
Comment 7 WebKit Commit Bot 2017-03-18 17:58:31 PDT
All reviewed patches have been landed.  Closing bug.