Bug 27526 - Inspector: Removing an Attribute via Edit should Delete the Attribute, Not Ignore Your Changes
Summary: Inspector: Removing an Attribute via Edit should Delete the Attribute, Not Ig...
Status: RESOLVED DUPLICATE of bug 27673
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-21 16:55 PDT by Joseph Pecoraro
Modified: 2009-07-24 23:51 PDT (History)
0 users

See Also:


Attachments
Removing an Attribute Deletes the Attribute - And Fix Possible Exception (2.41 KB, patch)
2009-07-21 17:37 PDT, Joseph Pecoraro
abarth: review-
Details | Formatted Diff | Diff
Example Page Showing the Caught Error (819 bytes, text/html)
2009-07-21 17:39 PDT, Joseph Pecoraro
no flags Details
Applies to ToT (2.32 KB, patch)
2009-07-24 07:12 PDT, Joseph Pecoraro
joepeck: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ***