Nightly の XMLHttpRequest で text/html がパース可能に!

Nightlyに入ったー

function getDocument (aURL, aCallback) {
  var xhr = new XMLHttpRequest;
  xhr.open("GET", aURL, true);
  xhr.responseType = "document";
  xhr.onreadystatechange = function() {
    if (xhr.readyState === xhr.DONE /* 4 */ &&
        xhr.status === 200) {
      aCallback(xhr.response);
    }
  };
  xhr.send(null);
}

getDocument("http://www.example.com", function (doc) {
  console.log(doc.querySelector("h1").innerHTML);
});

みたいな事が可能に!

来年3月が待ち遠しい!