Bug 27526

Summary: Inspector: Removing an Attribute via Edit should Delete the Attribute, Not Ignore Your Changes
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Attachments:
Description Flags
Removing an Attribute Deletes the Attribute - And Fix Possible Exception
abarth: review-
Example Page Showing the Caught Error
none
Applies to ToT joepeck: review-

Description Joseph Pecoraro 2009-07-21 16:55:24 PDT
This decision must have been made in the past.  When editing an element's attribute in the Element Panel's Tree, if you remove all of the text and commit the change, your changes are ignored.  I would have expected this to remove the attribute.  Was there a good reason for this?  Was it to prevent accidental errors?  Otherwise there is no way to remove an attribute via the tree (you can always use the console).
Comment 1 Joseph Pecoraro 2009-07-21 17:37:59 PDT
Created attachment 33231 [details]
Removing an Attribute Deletes the Attribute - And Fix Possible Exception

NOTES:

1. This will delete an attribute _if_ that attribute previously existed.  The only time an attribute would not previously exist would be if it is a "new" attribute.  This means this is compatible with the (uncommitted) patch on the following bug to create new attributes:
https://bugs.webkit.org/show_bug.cgi?id=21108

2. This fixes an error that has been around for a while where an invalid attribute from user input (such as "-") can cause an error.  An example test case will be attached in a minute.
Comment 2 Joseph Pecoraro 2009-07-21 17:39:07 PDT
Created attachment 33232 [details]
Example Page Showing the Caught Error

This shows why the try/catch fixes an error. If the user edits an attribute and changes all the text to "-" the innerHTML works fine but the setAttribute() would throw an Error.
Comment 3 Adam Barth 2009-07-24 00:55:43 PDT
Comment on attachment 33231 [details]
Removing an Attribute Deletes the Attribute - And Fix Possible Exception

This patch does not apply cleanly to TOT.  I haven't looked whether the merge is trivial.
Comment 4 Joseph Pecoraro 2009-07-24 07:12:55 PDT
Created attachment 33439 [details]
Applies to ToT

- Fixed a Style Issue as well
Comment 5 Joseph Pecoraro 2009-07-24 23:29:33 PDT
Comment on attachment 33439 [details]
Applies to ToT

I added this functionality into bug 27673, which does more and includes this feature.
Comment 6 Joseph Pecoraro 2009-07-24 23:51:40 PDT

*** This bug has been marked as a duplicate of bug 27673 ***