<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[194437] trunk/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194437">194437</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-29 10:15:45 -0800 (Tue, 29 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Styling of invalid selector persists when changing the selected node
https://bugs.webkit.org/show_bug.cgi?id=152456

Patch by Devin Rousso &lt;dcrousso+webkit@gmail.com&gt; on 2015-12-29
Reviewed by Brian Burg.

If the user changes the selector of a CSS rule to be invalid (e.g. having
a { or ; character), it is expected that the invalid indicator will be removed
once the user changes nodes or reverts the selector to its previous value.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/CSSStyleDeclarationSection.css:
(.style-declaration-section &gt; .header &gt; .icon.toggle-able:hover):
(.style-declaration-section &gt; .header &gt; .icon.toggle-able:active):
(.style-declaration-section:not(.invalid-selector) &gt; .header &gt; .icon.toggle-able:hover): Deleted.
Added better :hover and :active styles.

* UserInterface/Views/CSSStyleDeclarationSection.js:
(WebInspector.CSSStyleDeclarationSection):
(WebInspector.CSSStyleDeclarationSection.prototype.refresh):
(WebInspector.CSSStyleDeclarationSection.prototype._handleIconElementClicked):
If the selector is invalid, simply refresh the section to regenerate the
original selector with correct content, specificity, and highlighting.

(WebInspector.CSSStyleDeclarationSection.prototype.get _hasInvalidSelector): Deleted.
Moved the state of the invalid selector to a member
variable instead of a DOM class.

(WebInspector.CSSStyleDeclarationSection.prototype._updateSelectorIcon):
Renamed from _markSelector for clarity.

* UserInterface/Views/VisualStyleSelectorTreeItem.css:
(.item.visual-style-selector-item.selector-invalid &gt; .icon:hover):
(.item.visual-style-selector-item.selector-invalid &gt; .icon:active):
(.item.visual-style-selector-item.selector-invalid &gt; .icon):
Added :hover and :active styles.

* UserInterface/Views/VisualStyleSelectorTreeItem.js:
(WebInspector.VisualStyleSelectorTreeItem):
(WebInspector.VisualStyleSelectorTreeItem.prototype.onattach):
(WebInspector.VisualStyleSelectorTreeItem.prototype._commitSelector):
(WebInspector.VisualStyleSelectorTreeItem.prototype._updateSelectorIcon):
(WebInspector.VisualStyleSelectorTreeItem.prototype._handleIconElementClicked):
(WebInspector.VisualStyleSelectorTreeItem.prototype._selectorChanged): Deleted.
Changed the names of a few functions to provide better
consistency across the classes in the Style sidebar.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectioncss">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsVisualStyleSelectorTreeItemcss">trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsVisualStyleSelectorTreeItemjs">trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2015-12-29  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
+
+        Web Inspector: Styling of invalid selector persists when changing the selected node
+        https://bugs.webkit.org/show_bug.cgi?id=152456
+
+        Reviewed by Brian Burg.
+
+        If the user changes the selector of a CSS rule to be invalid (e.g. having
+        a { or ; character), it is expected that the invalid indicator will be removed
+        once the user changes nodes or reverts the selector to its previous value.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Views/CSSStyleDeclarationSection.css:
+        (.style-declaration-section &gt; .header &gt; .icon.toggle-able:hover):
+        (.style-declaration-section &gt; .header &gt; .icon.toggle-able:active):
+        (.style-declaration-section:not(.invalid-selector) &gt; .header &gt; .icon.toggle-able:hover): Deleted.
+        Added better :hover and :active styles.
+
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        (WebInspector.CSSStyleDeclarationSection):
+        (WebInspector.CSSStyleDeclarationSection.prototype.refresh):
+        (WebInspector.CSSStyleDeclarationSection.prototype._handleIconElementClicked):
+        If the selector is invalid, simply refresh the section to regenerate the
+        original selector with correct content, specificity, and highlighting.
+
+        (WebInspector.CSSStyleDeclarationSection.prototype.get _hasInvalidSelector): Deleted.
+        Moved the state of the invalid selector to a member
+        variable instead of a DOM class.
+
+        (WebInspector.CSSStyleDeclarationSection.prototype._updateSelectorIcon):
+        Renamed from _markSelector for clarity.
+
+        * UserInterface/Views/VisualStyleSelectorTreeItem.css:
+        (.item.visual-style-selector-item.selector-invalid &gt; .icon:hover):
+        (.item.visual-style-selector-item.selector-invalid &gt; .icon:active):
+        (.item.visual-style-selector-item.selector-invalid &gt; .icon):
+        Added :hover and :active styles.
+
+        * UserInterface/Views/VisualStyleSelectorTreeItem.js:
+        (WebInspector.VisualStyleSelectorTreeItem):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype.onattach):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype._commitSelector):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype._updateSelectorIcon):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype._handleIconElementClicked):
+        (WebInspector.VisualStyleSelectorTreeItem.prototype._selectorChanged): Deleted.
+        Changed the names of a few functions to provide better
+        consistency across the classes in the Style sidebar.
+
</ins><span class="cx"> 2015-12-27  Brian Burg  &lt;bburg@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: improve pre-filled bugzilla link on Uncaught Exception reporter sheet
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -598,7 +598,7 @@
</span><span class="cx"> localizedStrings[&quot;The 'webkit' prefix is needed for this property.\nClick to insert a duplicate with the prefix.&quot;] = &quot;The 'webkit' prefix is needed for this property.\nClick to insert a duplicate with the prefix.&quot;;
</span><span class="cx"> localizedStrings[&quot;The 'webkit' prefix is not necessary.\nClick to insert a duplicate without the prefix.&quot;] = &quot;The 'webkit' prefix is not necessary.\nClick to insert a duplicate without the prefix.&quot;;
</span><span class="cx"> localizedStrings[&quot;The property '%s' is not supported.&quot;] = &quot;The property '%s' is not supported.&quot;;
</span><del>-localizedStrings[&quot;The selector '%s' is invalid.&quot;] = &quot;The selector '%s' is invalid.&quot;;
</del><ins>+localizedStrings[&quot;The selector '%s' is invalid.\nClick to revert to the previous selector.&quot;] = &quot;The selector '%s' is invalid.\nClick to revert to the previous selector.&quot;;
</ins><span class="cx"> localizedStrings[&quot;The value '%s' is not supported for this property.\nClick to delete and open autocomplete.&quot;] = &quot;The value '%s' is not supported for this property.\nClick to delete and open autocomplete.&quot;;
</span><span class="cx"> localizedStrings[&quot;The value '%s' needs units.\nClick to add 'px' to the value.&quot;] = &quot;The value '%s' needs units.\nClick to add 'px' to the value.&quot;;
</span><span class="cx"> localizedStrings[&quot;The  %s \ntable is empty.&quot;] = &quot;The  %s \ntable is empty.&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectioncss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.css        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -72,10 +72,14 @@
</span><span class="cx">     height: 16px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.style-declaration-section:not(.invalid-selector) &gt; .header &gt; .icon.toggle-able:hover {
</del><ins>+.style-declaration-section &gt; .header &gt; .icon.toggle-able:hover {
</ins><span class="cx">     filter: brightness(0.9);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.style-declaration-section &gt; .header &gt; .icon.toggle-able:active {
+    filter: brightness(0.8);
+}
+
</ins><span class="cx"> .style-declaration-section:not(.invalid-selector).rule-disabled &gt; .header &gt; .icon {
</span><span class="cx">     opacity: 0.5;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationSectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">         this._style = style || null;
</span><span class="cx">         this._selectorElements = [];
</span><span class="cx">         this._ruleDisabled = false;
</span><ins>+        this._hasInvalidSelector = false;
</ins><span class="cx"> 
</span><span class="cx">         this._element = document.createElement(&quot;div&quot;);
</span><span class="cx">         this._element.classList.add(&quot;style-declaration-section&quot;);
</span><span class="lines">@@ -104,7 +105,7 @@
</span><span class="cx">         if (style.editable) {
</span><span class="cx">             this._iconElement.classList.add(&quot;toggle-able&quot;);
</span><span class="cx">             this._iconElement.title = WebInspector.UIString(&quot;Comment All Properties&quot;);
</span><del>-            this._iconElement.addEventListener(&quot;click&quot;, this._toggleRuleOnOff.bind(this));
</del><ins>+            this._iconElement.addEventListener(&quot;click&quot;, this._handleIconElementClicked.bind(this));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         console.assert(iconClassName);
</span><span class="lines">@@ -113,7 +114,7 @@
</span><span class="cx">         if (!style.editable)
</span><span class="cx">             this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);
</span><span class="cx">         else if (style.ownerRule) {
</span><del>-            this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._markSelector.bind(this));
</del><ins>+            this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._updateSelectorIcon.bind(this));
</ins><span class="cx">             this._commitSelectorKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Enter, this._commitSelector.bind(this), this._selectorElement);
</span><span class="cx">             this._selectorElement.addEventListener(&quot;blur&quot;, this._commitSelector.bind(this));
</span><span class="cx">         } else
</span><span class="lines">@@ -263,6 +264,8 @@
</span><span class="cx">             this._originElement.append(WebInspector.UIString(&quot;HTML Attributes&quot;));
</span><span class="cx">             break;
</span><span class="cx">         }
</span><ins>+
+        this._updateSelectorIcon();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     highlightProperty(property)
</span><span class="lines">@@ -447,10 +450,13 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _toggleRuleOnOff()
</del><ins>+    _handleIconElementClicked()
</ins><span class="cx">     {
</span><del>-        if (this._hasInvalidSelector)
</del><ins>+        if (this._hasInvalidSelector) {
+            // This will revert the selector text to the original valid value.
+            this.refresh();
</ins><span class="cx">             return;
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         this._ruleDisabled = this._ruleDisabled ? !this._propertiesTextEditor.uncommentAllProperties() : this._propertiesTextEditor.commentAllProperties();
</span><span class="cx">         this._iconElement.title = this._ruleDisabled ? WebInspector.UIString(&quot;Uncomment All Properties&quot;) : WebInspector.UIString(&quot;Comment All Properties&quot;);
</span><span class="lines">@@ -557,27 +563,25 @@
</span><span class="cx">         this._style.ownerRule.selectorText = newSelectorText;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _markSelector(event)
</del><ins>+    _updateSelectorIcon(event)
</ins><span class="cx">     {
</span><del>-        var valid = event &amp;&amp; event.data &amp;&amp; event.data.valid;
-        this._element.classList.toggle(WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName, !valid);
-        if (valid) {
</del><ins>+        if (!this._style.ownerRule || !this._style.editable)
+            return;
+
+        this._hasInvalidSelector = event &amp;&amp; event.data &amp;&amp; !event.data.valid;
+        this._element.classList.toggle(&quot;invalid-selector&quot;, !!this._hasInvalidSelector);
+        if (!this._hasInvalidSelector) {
</ins><span class="cx">             this._iconElement.title = this._ruleDisabled ? WebInspector.UIString(&quot;Uncomment All Properties&quot;) : WebInspector.UIString(&quot;Comment All Properties&quot;);
</span><span class="cx">             this._selectorElement.title = null;
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        this._iconElement.title = WebInspector.UIString(&quot;The selector '%s' is invalid.&quot;).format(this._selectorElement.textContent.trim());
</del><ins>+        this._iconElement.title = WebInspector.UIString(&quot;The selector '%s' is invalid.\nClick to revert to the previous selector.&quot;).format(this._selectorElement.textContent.trim());
</ins><span class="cx">         this._selectorElement.title = WebInspector.UIString(&quot;Using the previous selector '%s'.&quot;).format(this._style.ownerRule.selectorText);
</span><del>-        for (var i = 0; i &lt; this._selectorElement.children.length; ++i)
</del><ins>+        for (let i = 0; i &lt; this._selectorElement.children.length; ++i)
</ins><span class="cx">             this._selectorElement.children[i].title = null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get _hasInvalidSelector()
-    {
-        return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName);
-    }
-
</del><span class="cx">     _editorContentChanged(event)
</span><span class="cx">     {
</span><span class="cx">         this._editorActive = true;
</span><span class="lines">@@ -596,7 +600,6 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.CSSStyleDeclarationSection.LockedStyleClassName = &quot;locked&quot;;
</span><span class="cx"> WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName = &quot;selector-locked&quot;;
</span><del>-WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName = &quot;invalid-selector&quot;;
</del><span class="cx"> WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName = &quot;last-in-group&quot;;
</span><span class="cx"> WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = &quot;matched&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsVisualStyleSelectorTreeItemcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.css (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.css        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.css        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -69,11 +69,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .item.visual-style-selector-item.selector-invalid &gt; .icon {
</span><del>-    width: 14px;
</del><span class="cx">     height: 14px;
</span><span class="cx">     content: url(../Images/Error.svg);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.item.visual-style-selector-item.selector-invalid &gt; .icon:hover {
+    filter: brightness(0.9);
+}
+
+.item.visual-style-selector-item.selector-invalid &gt; .icon:active {
+    filter: brightness(0.8);
+}
+
</ins><span class="cx"> .item.visual-style-selector-item.selector-invalid &gt; .titles &gt; .title {
</span><span class="cx">     position: relative;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsVisualStyleSelectorTreeItemjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js (194436 => 194437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js        2015-12-29 13:57:21 UTC (rev 194436)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js        2015-12-29 18:15:45 UTC (rev 194437)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">         this._iconClassName = iconClassName;
</span><span class="cx">         this._lastValue = title;
</span><span class="cx">         this._enableEditing = true;
</span><ins>+        this._hasInvalidSelector = false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -95,6 +96,8 @@
</span><span class="cx">         this._checkboxElement.addEventListener(&quot;change&quot;, this._handleCheckboxChanged.bind(this));
</span><span class="cx">         this._listItemNode.insertBefore(this._checkboxElement, this._iconElement);
</span><span class="cx"> 
</span><ins>+        this._iconElement.addEventListener(&quot;click&quot;, this._handleIconElementClicked.bind(this));
+
</ins><span class="cx">         this._mainTitleElement.spellcheck = false;
</span><span class="cx">         this._mainTitleElement.addEventListener(&quot;mousedown&quot;, this._handleMainTitleMouseDown.bind(this));
</span><span class="cx">         this._mainTitleElement.addEventListener(&quot;keydown&quot;, this._handleMainTitleKeyDown.bind(this));
</span><span class="lines">@@ -103,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx">         this.representedObject.addEventListener(WebInspector.CSSStyleDeclaration.Event.InitialTextModified, this._styleTextModified, this);
</span><span class="cx">         if (this.representedObject.ownerRule)
</span><del>-            this.representedObject.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._selectorChanged, this);
</del><ins>+            this.representedObject.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._updateSelectorIcon, this);
</ins><span class="cx"> 
</span><span class="cx">         this._styleTextModified();
</span><span class="cx">     }
</span><span class="lines">@@ -191,7 +194,7 @@
</span><span class="cx">         this._updateTitleTooltip();
</span><span class="cx"> 
</span><span class="cx">         let value = this.selectorText;
</span><del>-        if (value === this._lastValue &amp;&amp; this._valid)
</del><ins>+        if (value === this._lastValue &amp;&amp; !this._hasInvalidSelector)
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         this.representedObject.ownerRule.selectorText = value;
</span><span class="lines">@@ -202,13 +205,28 @@
</span><span class="cx">         this._listItemNode.classList.toggle(&quot;modified&quot;, this.representedObject.modified);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _selectorChanged(event)
</del><ins>+    _updateSelectorIcon(event)
</ins><span class="cx">     {
</span><del>-        this._valid = event &amp;&amp; event.data &amp;&amp; event.data.valid;
-        this._listItemNode.classList.toggle(&quot;selector-invalid&quot;, !this._valid);
-        let invalidTitle = WebInspector.UIString(&quot;The selector '%s' is invalid.&quot;).format(this.selectorText);
-        this._iconElement.title = !this._valid ? invalidTitle : null;
</del><ins>+        this._hasInvalidSelector = event &amp;&amp; event.data &amp;&amp; !event.data.valid;
+        this._listItemNode.classList.toggle(&quot;selector-invalid&quot;, !!this._hasInvalidSelector);
+        if (this._hasInvalidSelector) {
+            this._iconElement.title = WebInspector.UIString(&quot;The selector '%s' is invalid.\nClick to revert to the previous selector.&quot;).format(this.selectorText);
+            this.mainTitleElement.title = WebInspector.UIString(&quot;Using the previous selector '%s'.&quot;).format(this.representedObject.ownerRule.selectorText);
+            return;
+        }
+
+        this._iconElement.title = null;
+        this.mainTitleElement.title = null;
</ins><span class="cx">     }
</span><ins>+
+    _handleIconElementClicked(event)
+    {
+        if (this._hasInvalidSelector &amp;&amp; this.representedObject.ownerRule) {
+            this.mainTitleElement.textContent = this._lastValue = this.representedObject.ownerRule.selectorText;
+            this._updateSelectorIcon();
+            return;
+        }
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WebInspector.VisualStyleSelectorTreeItem.Event = {
</span></span></pre>
</div>
</div>

</body>
</html>