Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I keep the "Elements" (DOM) tree open in the Webkit Inspector?

In the Webkit Inspector, I can go to the elements panel and unfold the DOM elements so I can see what I'm interested in.

So far, when I find what I'm looking for, change code, and reload the page, the DOM tree in the Elements panel is folded back up.

Is there any way to either, A) Get the Inspector to remember where I was and try to open the DOM tree to where I was, or B) Keep the DOM tree unfolded by default?

like image 289
user225643 Avatar asked Nov 15 '10 23:11

user225643


People also ask

How do you expand all elements in inspect?

If you hold ctrl + alt for windows (just opt on a mac) while clicking on the arrow of the element you want to expand, it will expand and all of its children will expand. So, if you ctrl + alt click on the <html> tag, that should expand the entire page.

How do I open a DOM tree?

Press Control + F or Command + F (Mac). The Search bar opens at the bottom of the DOM Tree.

How can I see all DOM elements?

To get all DOM elements by an attribute, use the querySelectorAll method, e.g. document. querySelectorAll('[class="box"]') . The querySelectorAll method returns a NodeList containing the elements that match the specified selector.


1 Answers

I had this same question. I'm using Chrome on Win XP so I can only tell you the solution I found for Chrome, but I imagine the process is very similar for other Webkit browsers.

I navigated to the Chrome Application Data folder: C:\Documents and Settings\[USERNAME]\Local Settings\Application Data\Google\Chrome\Application[NEWEST VERSION]\Resources\Inspector

Obviously fill in [USERNAME] and [NEWEST VERSION] with the folders YOU have on your computer.

Closed the browser.

I opened DevTools.js in Notepad++ and started hunting. It turns out that the webkit inspector adds a css property of "expanded" on tags when you click on the little arrow.

On line 1484 There is a boolean for the default value. I simply changed this.expanded=false to this.expanded=true

Fired up Chrome and badda-bing, all the elements in the inspector are expanded by default.

like image 174
Motionharvest Avatar answered Nov 23 '22 07:11

Motionharvest