No, this is still not what I need ;)

Let me give you a complete example of what I want:

Case 1)

<div id="myElement">
 <div class="MyTargetClass" id="found">
    <div class="SomeOtherClass"></div>
 </div>
</div>
<div class="MyTargetClass"></div>

Case 2)

<div id="myElement">
 <div class="SomeOtherClass">
    <div class="MyTargetClass" id="notFound"></div>
 </div>
</div>
<div class="MyTargetClass"></div>

-> I want to fetch the *direct* child of myElement if it has a class of
MyTargetClass.And I get a reference to myElement as a DOM element.

So in case 1, it should return an element (the one with id="found"), but in
case 2 it should return NOTHING (the element id="notFound" is not a direct
child).

How would you achieve that in Qooxdoo?

Jean-Noel

On Tue, Jun 23, 2009 at 10:12 AM, Alexander Back <[email protected]>wrote:

> Hi Jean-Noel,
>
> On Monday 22 June 2009 Jean-Noël Rivasseau wrote:
> > That's the point, I want to query from the element base, not the whole
> > document.
> Then you have to provide the second parameter. This parameter will set the
> root for the query.
>
> > Actually what I want is a bit more complex, I want to return:
> > > .FirstClass > .SecondClass
> >
> > from the element base, that is an element that has the current element as
> a
> > grandfather (and has the class SecondClass, with its parent the class
> > FirstClass).
> > I cannot really do this with Collection.query, because if I write:
> >
> > qx.bom.Collection.query(".FirstClass > .SecondClass",myDomElement)[0];
> >
> > it can return an element that had not the base element as a
> grandfather...
> > All these problems would be solved if the :root syntax was supported I
> > guess, but as it is not what should I use ?
> If I understand you correctly the second parameter will do the job.
>
> Suppose you have the following DOM fragment (all childs of the body)
>
> --snip--
> <div id="myElement">
>  <div class="MyTargetClass">
>     <div class="MyTargetClass"></div>
>  </div>
> </div>
> <div class="MyTargetClass"></div>
> --snip--
>
> The query
>
> qx.bom.Collection.query(".MyTargetClass")
>
> would produce 3 hits and the query
>
> var rootNode = document.getElementById("myElement");
> qx.bom.Collection.query(".MyTargetClass", rootNode);
>
> would only produce 2 hits since the query only searches for elements with
> are
> children of "myElement".
>
> Is that the missing part you searched for?
>
> cheers,
>  Alex
>
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
> $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
>
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to