我只看了YUI3的源代碼。在幾行負責請求對象中https://raw.github.com/yui/yui3/master/src/io/js/io-upload-iframe.js是:
_uploadComplete: function(o, c) {
var io = this,
d = Y.one('#io_iframe' + o.id).get('contentWindow.document'),
b = d.one('body'),
p;
if (c.timeout) {
io._clearUploadTimeout(o.id);
}
try {
if (b) {
// When a response Content-Type of "text/plain" is used, Firefox and Safari
// will wrap the response string with <pre></pre>.
p = b.one('pre:first-child');
o.c.responseText = p ? p.get('text') : b.get('text');
Y.log('The responseText value for transaction ' + o.id + ' is: ' + o.c.responseText + '.', 'info', 'io');
}
else {
o.c.responseXML = d._node;
Y.log('The response for transaction ' + o.id + ' is an XML document.', 'info', 'io');
}
}
catch (e) {
o.e = "upload failure";
}
io.complete(o, c);
io.end(o, c);
// The transaction is complete, so call _dFrame to remove
// the event listener bound to the iframe transport, and then
// destroy the iframe.
w.setTimeout(function() { _dFrame(o.id); }, 0);
},
因此,一旦響應包含它返回主體內容爲「文本」「身體」節點。
o.c.responseText = p ? p.get('text') : b.get('text');
恕我直言,沒有機會得到innerHTML,如果有一個身體節點。我決定創建一個定製的IO Upload Iframe模塊,該模塊添加一個名爲「responseHTML」的附加屬性與body節點的innerHTML。
您可以從引擎收錄獲得源:http://pastebin.com/WadQgNP2
謝謝您的回答。不幸的是,它甚至沒有包含reponseXML屬性。我最終創建了一個修改後的IO Upload Iframe模塊,該模塊返回innerHTML作爲附加屬性(responseHTML)。我會將其添加爲我的問題的答案。 – Pascal