Is entry of context menu in Chrome dev tool correspond to UI view, and if so, how to show it on the page?

huangapple go评论71阅读模式
英文:

Is entry of context menu in Chrome dev tool correspond to UI view, and if so, how to show it on the page?

问题

在Chrome浏览器的“控制台”选项卡中,有一个上下文菜单下拉框。请参考以下内容。

Is entry of context menu in Chrome dev tool correspond to UI view, and if so, how to show it on the page?

当我检查页面上的元素时,上下文菜单下拉框将显示元素所在的“上下文”。我的问题是:这个上下文是否对应于网页中的子“视图”?如果是这样,我该如何显示与上下文相关的视图?

例如,整个Web视图始终对应于“top”。如果我选择“top”下的一个上下文,我该如何知道它对应于哪个子视图/区域?

英文:

In 'console' tab of Chrome browser there is a context menu dropdown. Please refer to below.

Is entry of context menu in Chrome dev tool correspond to UI view, and if so, how to show it on the page?

When i am inspecting an element on the page, the context menu dropdown will show the 'context' that the element is in. My question is: does this context correspond to a sub 'view' in the webpage? And if so, how can i display the view that's related to the context?

e.g. the entire web view is always corresponding to 'top'. if i select a context under 'top', how can i
know what sub view/area it corresponds to?

答案1

得分: 1

这里是翻译好的部分:

"Meanwhile here's a workaround:" -> "与此同时,以下是一种解决方法:"

"Switch to Elements panel" -> "切换到 Elements 面板"

"Select the context in the context dropdown in the console toolbar" -> "在控制台工具栏的上下文下拉菜单中选择上下文"

"Open devtools-on-devtools and run this console command in its window:" -> "打开 devtools-on-devtools 并在其窗口中运行以下控制台命令:"

"Save this command in devtools snippets to quickly re-run it later." -> "将此命令保存在 devtools snippets 中,以便以后快速重新运行。"

"How to open devtools-on-devtools:" -> "如何打开 devtools-on-devtools:"

"Open devtools first and switch its Dock side in the menu to a detached (floating) window" -> "首先打开 devtools 并在菜单中将其 Dock side 切换为独立的(浮动的)窗口"

"in the now detached devtools press <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>i</kbd> or <kbd>⌘</kbd><kbd>⌥</kbd><kbd>i</kbd> on MacOS," -> "在现在分离的 devtools 中按下 <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>i</kbd> 或在 MacOS 上按下 <kbd>⌘</kbd><kbd>⌥</kbd><kbd>i</kbd>,"

"which will open devtools-on-devtools in a new window" -> "这将在一个新窗口中打开 devtools-on-devtools"

英文:

There's no such feature so you can request it on https://crbug.com.

Meanwhile here's a workaround:

  1. Switch to Elements panel

  2. Select the context in the context dropdown in the console toolbar

  3. Open devtools-on-devtools and run this console command in its window:

    (async () =&gt; {
      const dom = UI.panels.console._view._consoleContextSelector._dropDown._selectedItem
                    .target().model(SDK.DOMModel);
      if (!dom._document) await dom.requestDocument();
      UI.panels.elements.revealAndSelectNode(dom._document);
    })();
    
  4. Save this command in devtools snippets to quickly re-run it later.

###How to open devtools-on-devtools:

  1. Open devtools first and switch its Dock side in the menu to a detached (floating) window

Is entry of context menu in Chrome dev tool correspond to UI view, and if so, how to show it on the page?

  1. in the now detached devtools press <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>i</kbd> or <kbd>⌘</kbd><kbd>⌥</kbd><kbd>i</kbd> on MacOS,
    which will open devtools-on-devtools in a new window

huangapple
  • 本文由 发表于 2020年1月6日 16:35:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608915.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定