top | item 41270842

(no title)

config_yml | 1 year ago

Reminds me of Action Script 3 which had XML at the core of the language. It was a fun language to work with, but famously failed to become ES4. Oh well, took us 10+ years to arrive close to that with Typescript and JSX.

discuss

order

quink|1 year ago

https://en.wikipedia.org/wiki/ECMAScript_for_XML - Firefox had it too, but people at large just didn't want it, so it got removed. It got disabled for web pages with the release of Firefox 17, 6 months prior to the first release of React.

sltkr|1 year ago

Personally I never heard about it. So it might not be that people didn't want it, but that it wasn't promoted much.

Also, it sounds like the only browser to ever support it was Firefox? That was probably much more of a limiting factor for adoption.

mhitza|1 year ago

People didn't want it because browsers didn't support it (except FF, as you noted). Some of us had our fingers crossed that other browsers would pick it up.

shove|1 year ago

I don’t recall being able to construct XML inline like this unless maybe that was a Flex server thing?

zoogeny|1 year 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.

noduerme|1 year ago

I think parent must be referring to Flex components. AS3 itself had an XML library which I recall being absolute hell to work with. The better way to send things over the wire with AS3 was with AMF.