Inspect shadow dom with Firefox

2020-06-08 00:17发布

Is there a way to inspect shadow dom elements in Firefox like you can do with the Chrome dev tools?

2条回答
▲ chillily
2楼-- · 2020-06-08 00:46

Yes, we have added shadow DOM inspection to Firefox 65.0+ DevTools.

Shadow DOM in normal content pages is always displayed e.g.

By default shadow DOM for built in browser features is not displayed e.g here is a video element:

To enable viewing of the Shadow DOM for built in features:

  1. Go to about:config
  2. Set devtools.inspector.showUserAgentShadowRoots to true

After changing this setting you need to restart DevTools (or restart Firefox).

Now the Shadow DOM for built-in elements will be available:

查看更多
别忘想泡老子
3楼-- · 2020-06-08 00:52
  1. Type about:config in the browser address bar.
  2. Set devtools.inspector.showUserAgentShadowRoots to true
  3. Set devtools.inspector.showAllAnonymousContent to true (Firefox 77+)

enter image description here

查看更多
登录 后发表回答