tags:

views:

41

answers:

1

Hi,

I'm searching a possibility to get an array of elements in E4X for an unknown tagname (like the DOMs getElementsByTagName) inside of a function.

My first thought was something like:

(function (doc, tag) {
    return doc..[tag];
})

Is there any chance to do this?

+1  A: 
doc.descendants(tag);

And there's always eval :)

var query = "doc.." + tag;
eval(query);
Anurag
"If eval() is the answer, you're almost certainly asking the wrong question." - Rasmus Lerdorf, creator of PHP
invertedSpear
"evil is as eval does" - Anurag Mishra
Anurag
is this not good enough - `doc.descendants(tag);`?
Anurag
descendants() work. Thanks a lot!
FB55