gregtatum / z-index-devtool

A UCOSP project for building a Z-Index Devtool.
Mozilla Public License 2.0
31 stars 7 forks source link

Use the $0 API to show the stacking context tree below the currently selected element #89

Open bomsy opened 6 years ago

bomsy commented 6 years ago

How about using the $0 API to show the stacking context tree below the currently selected element? This way the extension will be nicely tied to the inspector.

And if it returns false, then default to document.documentElement (instead of body), to show the whole tree.

If we do this though, we will also need a visual indication of the fact that only a subtree is being shown. @captainbrosset

captainbrosset commented 6 years ago

Thanks for opening this as a separate issue. I now remember what the API is exactly. It's devtools.inspectedWindow.eval(). It turns out that you can use $0 inside the evaluated expression in order to refer to the currently selected element in the inspector.

Here's an idea:

What do you think @bomsy? Does this sound like a good idea?

Using the $0 trick can be useful for another feature idea I have: the tool could provide an option to compare nodes. But I'll file this as a new issue.

bomsy commented 6 years ago

I like this.. i think its a great idea.