3 ms·
I don't recall being able to do the XML construction inline either, but that just might be my memory. However, the XML selector syntax was a godsend. Recursive
by zoogeny 2y ago
I don't recall being able to do the XML construction inline either, but that just might be my memory.
However, the XML selector syntax was a godsend. Recursively parsing an XML tree is really a pain. E4X would allow you to do things like:
var foo = someXml..childNodes.@attribute;
I'm not even sure if that would work actually. There were a bunch of operators for doing things like getting a collection of children that all had the same tag so you could work with XML like:
<someXml>
<intermediateNodeYouWantToSkip>
<childNode attribute="1" />
<childNode attribute="2" />
<childNode attribute="3" />
<unrelatedNode />
</intermediateNodeYouWantToSkip>
</someXml>
Another post here said people didn't want it, but I don't think that was the real reason it was dropped. There was a lot of drama at the time about Flash in general and a massive debacle about EcmaScript 4 (which ActionScript more or less adopted). There was also the whole XHTML thing happening.
Basically JSON as a format won out over XML and ES4/XHTML were ditched. Frankly, a world that revolved around XML/SOAP would have been a nightmare, so I guess killing off the easy processing of XML in JavaScript helped to stave off that potential future. XSS, XSLT and E4X were all casualties.