Array extensions are nice, but I really wanted to check out the implementation of ECMAScript for XML (E4X). So I opened up my editor and typed a simple E4X example, loaded it up and…got a syntax error. After some digging around, I found that you need a specific content type on the
<script/> tag in order to make it work. Simply doing
I’m not sure how well this will go over. By doing this, Internet Explorer ignores the code altogether, which could be good or bad. On the one hand, it ensures that other browsers will (hopefully) ignore script that they don’t support. On the other hand, though, it disallows testing for E4X support by testing for the
These issues aside, I must say that I love E4X. I loved it when I read the initial spec and wrote about it in my book, and I love it even more now that I’m able to use it in a browser. This is the best thing to happen to the Web since the DOM.
Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.
Both comments and pings are currently closed.