Bug 139623

Summary: Web Inspector: Empty attribute added to a DOM tree outline element should not add whitespace within the tag
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
bburg: review+
Patch none

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
<rdar://problem/19281562>
Comment 2 Devin Rousso 2017-03-16 18:54:18 PDT
Created attachment 304738 [details]
Patch
Comment 3 Nikita Vasilyev 2017-03-18 16:25:56 PDT
Comment on attachment 304738 [details]
Patch

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 BJ Burg 2017-03-18 17:07:23 PDT
Comment on attachment 304738 [details]
Patch

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

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.