]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/request/handlers.js.uncompressed.js
1 define("dojo/request/handlers", [
6 ], function(JSON
, kernel
, array
, has
){
7 has
.add('activex', typeof ActiveXObject
!== 'undefined');
11 // GUIDs obtained from http://msdn.microsoft.com/en-us/library/ms757837(VS.85).aspx
13 'Msxml2.DOMDocument.6.0',
14 'Msxml2.DOMDocument.4.0',
15 'MSXML2.DOMDocument.3.0',
16 'MSXML.DOMDocument' // 2.0
19 handleXML = function(response
){
20 var result
= response
.data
;
22 if(!result
|| !result
.documentElement
){
23 var text
= response
.text
;
24 array
.some(dp
, function(p
){
26 var dom
= new ActiveXObject(p
);
30 }catch(e
){ return false; }
40 'javascript': function(response
){
41 return kernel
.eval(response
.text
|| '');
43 'json': function(response
){
44 return JSON
.parse(response
.text
|| null);
49 function handle(response
){
50 var handler
= handlers
[response
.options
.handleAs
];
52 response
.data
= handler
? handler(response
) : (response
.data
|| response
.text
);
57 handle
.register = function(name
, handler
){
58 handlers
[name
] = handler
;