Bug 104902 - Web Inspector: "Add Attribute" context menu on closing tag should apply on the opening tag on Elements Panel
Summary: Web Inspector: "Add Attribute" context menu on closing tag should apply on th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Vivek Galatage
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-13 04:14 PST by Vivek Galatage
Modified: 2012-12-13 07:25 PST (History)
9 users (show)

See Also:


Attachments
Patch (2.06 KB, patch)
2012-12-13 04:17 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff
Patch (2.55 KB, patch)
2012-12-13 04:59 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff
Patch (2.55 KB, patch)
2012-12-13 06:41 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Galatage 2012-12-13 04:14:04 PST
Web Inspector: "Add Attribute" context menu shouldn't appear on closing tag on Elements Panel.

Steps:
1. Open any page with inspector open
2. Navigate to Elements panel
3. Expand some nodes so you can view the closing tag separately
4. Perform action (right click for linux/windows) to open context menu on the Closing Tag.
5. "Add Attribute" context menu item is shown
6. Go ahead with adding some attribute value
7. The attribute is seen even on the closing tag
e.g. <div id="test">
         ...
     </div id="test">

Expected:
The "Add Attribute" on a closing tag shouldn't be shown

Patch to follow.
Comment 1 Vivek Galatage 2012-12-13 04:17:28 PST
Created attachment 179247 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2012-12-13 04:26:19 PST
Perhaps, instead of forbidding to add attributes on the closing tag, we might automatically add them to the opening tag? If |this| is the closing tag, you can bind this._addNewAttribute() to the opening tag using this.findTreeElement(this.representedObject), something like this:

contextMenu.appendItem(..., this._addNewAttribute.bind(this._elementCloseTag ? this.treeOutline.findTreeElement(this.representedObject) : this));
Comment 3 Vivek Galatage 2012-12-13 04:59:27 PST
Created attachment 179252 [details]
Patch
Comment 4 Alexander Pavlov (apavlov) 2012-12-13 05:05:42 PST
Comment on attachment 179252 [details]
Patch

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

The code looks good, just a minor ChangeLog fix is needed.

> Source/WebCore/ChangeLog:8
> +        The context menu action on the Closing Tag takes to the Opening tag for adding the attribute.

There should be no caps in the middle of the sentence. Also, "takes" -> "scrolls to"

> Source/WebCore/ChangeLog:10
> +        No new tests as UI tweak.

No new tests, as this is a UI change.
(I've seen a guideline somewhere that imposes the use of common English rather than slang-ish/ambiguous terms, like "tweak".)
Comment 5 Vivek Galatage 2012-12-13 06:41:04 PST
Created attachment 179264 [details]
Patch
Comment 6 Alexander Pavlov (apavlov) 2012-12-13 06:52:18 PST
Comment on attachment 179264 [details]
Patch

r=me
Comment 7 WebKit Review Bot 2012-12-13 07:25:22 PST
Comment on attachment 179264 [details]
Patch

Clearing flags on attachment: 179264

Committed r137594: <http://trac.webkit.org/changeset/137594>
Comment 8 WebKit Review Bot 2012-12-13 07:25:26 PST
All reviewed patches have been landed.  Closing bug.