<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>121665</bug_id>
          
          <creation_ts>2013-09-20 02:32:43 -0700</creation_ts>
          <short_desc>Web Inspector: Keep DOM tree expanded on page reload</short_desc>
          <delta_ts>2025-08-15 09:05:24 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ben Frain">contact</reporter>
          <assigned_to name="Antoine Quint">graouts</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>graouts</cc>
    
    <cc>joepeck</cc>
    
    <cc>peter.avis</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>931233</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Frain">contact</who>
    <bug_when>2013-09-20 02:32:43 -0700</bug_when>
    <thetext>When inspecting a web page with Web Inspector it&apos;s common to drill down the DOM tree and select an element to Inspect. Having altered that element externally the page is then reloaded. However, when the page is subsequently reloaded the DOM tree is then totally collapsed necessitating drilling down through the DOM again. When iterating through site designs this makes for an extremely tiresome debugging experience.

Can we see the same action as the Chrome/Firefox dev tools whereby the current expansion state of the DOM is retained on subsequent page loads?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>931234</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2013-09-20 02:33:05 -0700</bug_when>
    <thetext>&lt;rdar://problem/15038868&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933491</commentid>
    <comment_count>2</comment_count>
      <attachid>212707</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2013-09-26 07:50:14 -0700</bug_when>
    <thetext>Created attachment 212707
Testcase

The attached test case shows that if you inspect the black rectangle, which is &lt;div&gt; nested 10 levels deep, and hit reload, we more often than not expand to the same place in the tree again. However, there are cases when we do not. Trying the same thing in the Chrome inspector seems to work a lot more reliably.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933505</commentid>
    <comment_count>3</comment_count>
      <attachid>212711</attachid>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2013-09-26 08:09:18 -0700</bug_when>
    <thetext>Created attachment 212711
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933508</commentid>
    <comment_count>4</comment_count>
    <who name="Antoine Quint">graouts</who>
    <bug_when>2013-09-26 08:10:55 -0700</bug_when>
    <thetext>Attached patch seems to work well with pages I&apos;ve tested (apple.com, store.apple.com, lemonde.fr) but doesn&apos;t work for pages where the selected content had been generated by script, which also fails in the Chrome Web Inspector. I think this patch brings us to parity with Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933585</commentid>
    <comment_count>5</comment_count>
      <attachid>212711</attachid>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2013-09-26 10:44:06 -0700</bug_when>
    <thetext>Comment on attachment 212711
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=212711&amp;action=review

&gt; Source/WebInspectorUI/UserInterface/DOMTreeContentView.js:-300
&gt; -            // A selection was made while waiting for the async reply. Just bail now.
&gt; -            if (this._domTreeOutline.selectedTreeElement)
&gt; -                return;

I think this will regress a rarer scenario (the reason this code was originally added).

However, I think we should take this patch, which improves a very common case, and we should address the rare scenario in a different way.

I would guess the scenario this breaks is:

  1. Inspect for apple.com
  2. Inspect the inspector (aim to inspect element something deep in the tree, like a deeply nested DOM node in the DOM tree)
  3. When inspector² opens, quickly select something else in the DOM tree, like the Quick Console node
    =&gt; after a few beats, the DOM Tree will switch to show the originally selected &quot;inspect element&quot; node

I think we would want to do something like this bail only if &quot;a &lt;em&gt;user&lt;/em&gt; selection was made while waiting for the async reply&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933613</commentid>
    <comment_count>6</comment_count>
    <who name="Ben Frain">contact</who>
    <bug_when>2013-09-26 11:27:35 -0700</bug_when>
    <thetext>The principal reason this came to my attention was inspecting the iOS simulator. Viewing and inspecting any web page there causes this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933614</commentid>
    <comment_count>7</comment_count>
      <attachid>212711</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-09-26 11:28:42 -0700</bug_when>
    <thetext>Comment on attachment 212711
Patch

Clearing flags on attachment: 212711

Committed r156481: &lt;http://trac.webkit.org/changeset/156481&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>933615</commentid>
    <comment_count>8</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2013-09-26 11:28:44 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2136787</commentid>
    <comment_count>9</comment_count>
    <who name="">peter.avis</who>
    <bug_when>2025-08-15 09:05:24 -0700</bug_when>
    <thetext>The bug is back again.

Go to apple.com -&gt; select a nested element -&gt; reload page -&gt; the domain is collapsed and the previously selected dom element not selected anymore

Im using Release 225 (WebKit 20623.1.1.1)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>212707</attachid>
            <date>2013-09-26 07:50:14 -0700</date>
            <delta_ts>2013-09-26 07:50:14 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>expansion.html</filename>
            <type>text/html</type>
            <size>352</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">PGRpdj4KICA8ZGl2PgogICAgPGRpdj4KICAgICAgPGRpdj4KICAgICAgICA8ZGl2PgogICAgICAg
ICAgPGRpdj4KICAgICAgICAgICAgPGRpdj4KICAgICAgICAgICAgICA8ZGl2PgogICAgICAgICAg
ICAgICAgPGRpdj4KICAgICAgICAgICAgICAgICAgPGRpdiBzdHlsZT0id2lkdGg6IDEwMHB4OyBo
ZWlnaHQ6IDEwMHB4OyBiYWNrZ3JvdW5kLWNvbG9yOiBibGFjazsiPjwvZGl2PgogICAgICAgICAg
ICAgICAgPC9kaXY+CiAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgIDwvZGl2PgogICAg
ICAgICAgPC9kaXY+CiAgICAgICAgPC9kaXY+CiAgICAgIDwvZGl2PgogICAgPC9kaXY+CiAgPC9k
aXY+CjwvZGl2Pg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>212711</attachid>
            <date>2013-09-26 08:09:18 -0700</date>
            <delta_ts>2013-09-26 11:28:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-121665-20130926170922.patch</filename>
            <type>text/plain</type>
            <size>1744</size>
            <attacher name="Antoine Quint">graouts</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTU2NDUxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViSW5zcGVj
dG9yVUkvQ2hhbmdlTG9nIGIvU291cmNlL1dlYkluc3BlY3RvclVJL0NoYW5nZUxvZwppbmRleCA5
NjljM2NlMzQ1Y2RjNmY1MWE5NGY4YTAxMWY1YjQwZDQ1NDg2NzNmLi4xMzg1ZjYzMDhjZjU1YTFm
YjUzNmQxZjljZDJkYThiMDgxM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