-
26 Jun 2009 1:36 AM #21Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
- Answers
- 1
How about an extra pseudo operator?
Now you can simply use:Code:Ext.DomQuery.pseudos.nodeType = function(c, a){ var r = [], ri = -1, n; for(var i = 0; n = c[i]; i++){ if(n.nodeType == a){ r[++ri] = n; } } return r; };
Code:Ext.Element.prototype.getChildren = function(){ return this.select('> *:nodeType(1)'); };
-
26 Jun 2009 2:47 AM #22
like it
like it
Just did a quick test and it works a treat
Another great approach
It also has the benefit of being flexible enough that you can pass in the nodeType you could be looking for.
I tested for textNodes and it pulled them out as well
It also seems a natural fit with the other pseudo selectors as there is a pseudo selector that checks the nodeValue.
Thanks Condor
-
26 Jun 2009 2:51 AM #23
Thanks ...
Thanks ...
Was looking for how to do this .. I tried tons of stuff
.. thanks!Ext.Element.prototype.getChildren = function(){
return this.select('> *:nodeType(1)');
};Joseph Francis,
CoreLan / Meeting Consultants
-
26 Jun 2009 4:04 AM #24
flexible and now for getSiblings()
flexible and now for getSiblings()
Just to show off its flexible benefits of Condor's approach
Code:Ext.Element.prototype.getSiblings = function(){ //Condor return this.select('~ *:nodeType(1)'); };Code:Ext.get('pane1').getSiblings()
-
26 Jun 2009 4:33 PM #25Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,103
- Vote Rating
- 97
- Answers
- 170
I think you're the only person to use the ~ operator. A bug was fixed in it a while back and I don't think anyone noticed
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
1 Jul 2009 1:42 AM #26
-
1 Jul 2009 1:45 AM #27Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
- Answers
- 1
-
1 Jul 2009 2:07 AM #28
-
1 Jul 2009 2:11 AM #29
CSS references
-
1 Jul 2009 2:12 AM #30


Reply With Quote
by the way, where can I get some more reference or examples to learn about the ~ operator?