RESOLVED DUPLICATE of bug 27673 27526
Inspector: Removing an Attribute via Edit should Delete the Attribute, Not Ignore Your Changes
https://bugs.webkit.org/show_bug.cgi?id=27526
Summary Inspector: Removing an Attribute via Edit should Delete the Attribute, Not Ig...
Joseph Pecoraro
Reported 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).
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-
Example Page Showing the Caught Error (819 bytes, text/html)
2009-07-21 17:39 PDT, Joseph Pecoraro
no flags
Applies to ToT (2.32 KB, patch)
2009-07-24 07:12 PDT, Joseph Pecoraro
joepeck: review-
Joseph Pecoraro
Comment 1 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.
Joseph Pecoraro
Comment 2 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.
Adam Barth
Comment 3 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.
Joseph Pecoraro
Comment 4 2009-07-24 07:12:55 PDT
Created attachment 33439 [details] Applies to ToT - Fixed a Style Issue as well
Joseph Pecoraro
Comment 5 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.
Joseph Pecoraro
Comment 6 2009-07-24 23:51:40 PDT
*** This bug has been marked as a duplicate of bug 27673 ***
Note You need to log in before you can comment on or make changes to this bug.