Title: [256006] trunk/Source/WebInspectorUI
Revision
256006
Author
[email protected]
Date
2020-02-06 19:45:12 -0800 (Thu, 06 Feb 2020)

Log Message

[Web Inspector][WinCairo] Selecting an error message in Console causes "TypeError:​ selection.focusNode.closest is not a function."
https://bugs.webkit.org/show_bug.cgi?id=207248

Reviewed by Devin Rousso.

r242174 replaced Node.enclosingNodeOrSelfWithClass with
Element.closest. However, selection.focusNode isn't necessarily an
Element, but can be a Text node.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype._mousemove): Use selection.focusNode.parentElement.closest
if selection.focusNode is not a instance of Element.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (256005 => 256006)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-02-07 03:30:42 UTC (rev 256005)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-02-07 03:45:12 UTC (rev 256006)
@@ -1,3 +1,18 @@
+2020-02-06  Fujii Hironori  <[email protected]>
+
+        [Web Inspector][WinCairo] Selecting an error message in Console causes "TypeError:​ selection.focusNode.closest is not a function."
+        https://bugs.webkit.org/show_bug.cgi?id=207248
+
+        Reviewed by Devin Rousso.
+
+        r242174 replaced Node.enclosingNodeOrSelfWithClass with
+        Element.closest. However, selection.focusNode isn't necessarily an
+        Element, but can be a Text node.
+
+        * UserInterface/Views/LogContentView.js:
+        (WI.LogContentView.prototype._mousemove): Use selection.focusNode.parentElement.closest
+        if selection.focusNode is not a instance of Element.
+
 2020-02-06  Devin Rousso  <[email protected]>
 
         Web Inspector: REGRESSION(r249831): Sources: endless spinner when trying to view a resource

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (256005 => 256006)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2020-02-07 03:30:42 UTC (rev 256005)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2020-02-07 03:45:12 UTC (rev 256006)
@@ -548,8 +548,12 @@
 
         if (!wrapper) {
             // No wrapper under the mouse, so look at the selection to try and find one.
-            if (!selection.isCollapsed)
-                wrapper = selection.focusNode.closest("." + WI.LogContentView.ItemWrapperStyleClassName);
+            if (!selection.isCollapsed) {
+                let focusElement = selection.focusNode;
+                if (!(focusElement instanceof Element))
+                    focusElement = focusElement.parentElement;
+                wrapper = focusElement.closest("." + WI.LogContentView.ItemWrapperStyleClassName);
+            }
 
             if (!wrapper) {
                 selection.removeAllRanges();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to