Better yet, why doesn't Microsoft implement XLINQ like support in the JScript engine for IE?
var order = <order><customer>. . .</customer>
var items = order.item; // XMLList of item el'ts
var prices = order..price;
var urgentItems = order.item.(@level == "rush");
var itemAttrs = order.item.@*;
var request = new XMLHttpRequest();
request.open("GET", "/index.php/main/rss_2.0", false);
var rss = new XML(request.responseText.replace(/^[\s\S]*<rss/, "<rss"));
var dc = new Namespace("http://purl.org/dc/elements/1.1/");
alert(item.title + "\n\n" + item.description);
But I think this is the coolest - E4X with Expandos:
var html = <html/>;
html.head.title = "My Page Title";
html.body.@bgcolor = "#e4e4e4";
html.body.form.@name = "myform";
html.body.form.@action = "someurl.jss";
html.body.form.@method = "post";
html.body.form.@onclick = "return somejs();";
html.body.form.input = "";
html.body.form.input.@name = "test";
// gives you this:
<title>My Page Title</title>
<form name="myform" action="someurl.jss"
method="post" onclick="return somejs();">
What's the point? The point is that:
- AJAX is here and it's big, like it or not
- You can't have it. It's great, it would make the internet a better place (for developers and users), and you can't have it because it's not going to be supported in IE anytime soon. Bummer.
Hacked.Brain wants it. Andrew Stopford wants it. Me likum the E4X, too.