forked from Modernizr/Modernizr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType='arraybuffer'", | ||
"property": "xhrresponsetypearraybuffer", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType='arraybuffer'. | ||
*/ | ||
define(['Modernizr', 'testXhrType'], function( Modernizr, testXhrType ) { | ||
Modernizr.addTest('xhrresponsetypearraybuffer', testXhrType('arraybuffer')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType='blob'", | ||
"property": "xhrresponsetypeblob", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType='blob'. | ||
*/ | ||
define(['Modernizr', 'testXhrType'], function( Modernizr, testXhrType ) { | ||
Modernizr.addTest('xhrresponsetypeblob', testXhrType('blob')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType='document'", | ||
"property": "xhrresponsetypedocument", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType='document'. | ||
*/ | ||
define(['Modernizr', 'testXhrType'], function( Modernizr, testXhrType ) { | ||
Modernizr.addTest('xhrresponsetypedocument', testXhrType('document')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType='json'", | ||
"property": "xhrresponsetypejson", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
},{ | ||
"name": "Explanation of xhr.responseType='json'", | ||
"href": "http://mathiasbynens.be/notes/xhr-responsetype-json" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType='json'. | ||
*/ | ||
define(['Modernizr', 'testXhrType'], function( Modernizr, testXhrType ) { | ||
Modernizr.addTest('xhrresponsetypejson', testXhrType('json')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType='text'", | ||
"property": "xhrresponsetypetext", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType='text'. | ||
*/ | ||
define(['Modernizr', 'testXhrType'], function( Modernizr, testXhrType ) { | ||
Modernizr.addTest('xhrresponsetypetext', testXhrType('text')); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*! | ||
{ | ||
"name": "XMLHttpRequest xhr.responseType", | ||
"property": "xhrresponsetype", | ||
"tags": ["network"], | ||
"notes": [{ | ||
"name": "XMLHttpRequest Living Standard", | ||
"href": "http://xhr.spec.whatwg.org/#the-responsetype-attribute" | ||
}] | ||
} | ||
!*/ | ||
/* DOC | ||
Tests for XMLHttpRequest xhr.responseType. | ||
*/ | ||
define(['Modernizr'], function( Modernizr ) { | ||
Modernizr.addTest('xhrresponsetype', (function() { | ||
if (typeof XMLHttpRequest == 'undefined') { | ||
return false; | ||
} | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('get', '/', true); | ||
return 'response' in xhr; | ||
}())); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
define(function() { | ||
// http://mathiasbynens.be/notes/xhr-responsetype-json#comment-4 | ||
var testXhrType = function(type) { | ||
if (typeof XMLHttpRequest == 'undefined') { | ||
return false; | ||
} | ||
var xhr = new XMLHttpRequest(); | ||
xhr.open('get', '/', true); | ||
try { | ||
xhr.responseType = type; | ||
} catch(error) { | ||
return false; | ||
} | ||
return 'response' in xhr && xhr.responseType == type; | ||
}; | ||
|
||
return testXhrType; | ||
}); |