RESOLVED FIXED Bug 173747
Web Inspector: Use Element.closest for internal code
https://bugs.webkit.org/show_bug.cgi?id=173747
Summary Web Inspector: Use Element.closest for internal code
Nikita Vasilyev
Reported 2017-06-22 16:56:55 PDT
There're a few methods defined in Utilities.js that could be replaced by Element.prototype.closest[1]: Node.prototype.enclosingNodeOrSelfWithClass Node.prototype.enclosingNodeOrSelfWithNodeName Node.prototype.enclosingNodeOrSelfWithNodeNameInArray [1]: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
Attachments
Patch (30.30 KB, patch)
2019-02-27 13:48 PST, Devin Rousso
no flags
Patch (30.30 KB, patch)
2019-02-27 15:15 PST, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-02-27 13:48:33 PST
Created attachment 363127 [details] Patch I haven't tested every single case, but the ones I did worked fine :)
Joseph Pecoraro
Comment 2 2019-02-27 15:12:23 PST
Comment on attachment 363127 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=363127&action=review r=me > Source/WebInspectorUI/UserInterface/Base/Main.js:2340 > + let contentBrowserElement = this.currentFocusElement.closest("content-browser"); This should be ".content-browser"
Devin Rousso
Comment 3 2019-02-27 15:15:00 PST
WebKit Commit Bot
Comment 4 2019-02-27 15:54:48 PST
Comment on attachment 363137 [details] Patch Clearing flags on attachment: 363137 Committed r242174: <https://trac.webkit.org/changeset/242174>
WebKit Commit Bot
Comment 5 2019-02-27 15:54:49 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 6 2019-02-27 15:55:40 PST
Fujii Hironori
Comment 7 2020-02-06 02:39:43 PST
Comment on attachment 363137 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=363137&action=review > Source/WebInspectorUI/UserInterface/Views/LogContentView.js:536 > + wrapper = selection.focusNode.closest("." + WI.LogContentView.ItemWrapperStyleClassName); selection.focusNode isn't necessarily an Element. Filed: Bug 207248 – [Web Inspector][WinCairo] Selecting an error message in Console causes "TypeError:​ selection.focusNode.closest is not a function."
Note You need to log in before you can comment on or make changes to this bug.