Closed Bug 296358 Opened 20 years ago Closed 20 years ago

<children/> elements not accessible via this.firstChild in XBL/XUL

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
major

Tracking

()

RESOLVED INVALID

People

(Reporter: a.herz, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050517 Firefox/1.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050517 Firefox/1.0+

If I try access the <children> object it is unable to 
access the DOM children. In my example this.firstChildren 
is always null!

------------------------------------------------------
<content >
  <xul:hbox flex="1" style="margin:0;padding:0;">
     <xul:textbox popup="2"/>
       <xul:popup id="2" onselect="alert(this.firstChildren);">
           <children/>
       </xul:popup>
    </xul:hbox>
</content>


Reproducible: Always



Expected Results:  
this.firstChildren returns the first DOM node of the 
inserted objects
for more information see the (not working) example on
http://www.xulplanet.com/tutorials/xultu/xblex.html

In the code example the 'totalpages' are always '0':

<method name="setPage">
  <parameter name="newidx"/>
  <body>
    <![CDATA[
      var thedeck=document.getAnonymousNodes(this)[0].childNodes[0];
      var totalpages=this.childNodes.length;  

      if (newidx<0) return 0;
      if (newidx>=totalpages) return totalpages;
      thedeck.setAttribute("selectedIndex",newidx);
      document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1]
              .setAttribute("value",(newidx+1)+" of "+totalpages);
      return newidx;
    ]]>
  </body>
</method>
Sorry.

it's user error!

I should have in mind that I navigate in the DOM tree
of the XUL tree and not in the DOM tree within the 
<content> area.

SORRY
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.