I'm using E4X in SpiderMonkey, and the majority of the language seems pretty solid, but I can't get filtering to work:
var xml = <root>
<person id="dave">Dave</person>
<person id="ian">Ian</person>
<person>John</person>
</root>
trace( xml.*.(name() == 'person') );
trace( xml.*.(attribute('@id')) );
Expected:
<person id="dave">Dave</person>
<person id="ian">Ian</person>
<person>John</person>
<person id="dave">Dave</person>
<person id="ian">Ian</person>
Results:
ReferenceError: name is not defined
ReferenceError: attribute is not defined
I can't even get hasOwnProperty() to work either:
xml.*.(trace( hasOwnProperty('@id') ));
false
false
false
Specifically, I'm using JSFL in Flash, which uses the SpiderMonkey engine.
From my basic knowledge of E4X so far, this is pretty unexpected / buggy, right? As I can get these expressions to work just fine in ActionScript / FlashPlayer!
Thanks, Dave