* STEPS TO REPRODUCE: 1. Go to http://www.apple.com 2. Inspect the page and click on the <body> tag 3. Copy the selector below and paste it over one of the "body" selectors in the styles sidebar: body { color: red; } body 4. Select a different node and then reselect the <body> tag to refresh the styles sidebar Expected Result: The selector above is invalid and shouldn't be applied. Instead, the rule should revert to its original selector. Actual Result: A new rule is created above the edited rule with the text: body { color: red; }
<rdar://problem/21965500>
Created attachment 257426 [details] Patch
Comment on attachment 257426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257426&action=review Cool! Just some nits. > Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:325 > - changeRuleSelector(rule, selector) > + changeRuleSelector(rule, selector, callback) You didn't use a callback. Remove. > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css:164 > + width: 12px; > + height: 12px; > + content: url(../Images/Warning.svg); Can you post a screenshot? It might be odd to change to a smaller icon. We could show it bigger if needed. > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:524 > + for (var selectorElement of this._selectorElements) How are the _selectorElements here if you edited? Wouldn't they be gone until a commit and match happened again? I think the title of the parent of the _selectorElements would be better, since they all get the same title.
Comment on attachment 257426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257426&action=review >> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:524 >> + for (var selectorElement of this._selectorElements) > > How are the _selectorElements here if you edited? Wouldn't they be gone until a commit and match happened again? I think the title of the parent of the _selectorElements would be better, since they all get the same title. I have modified this to apply the title to _selectorElement, but I still have to remove the title on all of _selectorElement's children as most of them have a title that overrides the parent.
Created attachment 257577 [details] Patch
Created attachment 257578 [details] After Patch is applied (Resources) This is what will display when the selector is changed to something invalid. Hovering the warning icon will show "Using the previous selector <previous selector>." and hovering the selector text will show "The selector '<current selector>' is invalid.".
Comment on attachment 257578 [details] After Patch is applied (Resources) I would expect the commas to be red too. This should match the red color we use for errors in the console. We should consider showing the error icon instead of warning then. Weird to see yellow/orange icon and red text.
Created attachment 257637 [details] Patch
Comment on attachment 257637 [details] Patch Clearing flags on attachment: 257637 Committed r187500: <http://trac.webkit.org/changeset/187500>
All reviewed patches have been landed. Closing bug.