mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-05-02 03:03:05 -04:00
Merge branch 'master' of https://github.com/Modernizr/Modernizr
This commit is contained in:
@@ -205,7 +205,7 @@ module.exports = function( grunt ) {
|
||||
// Remove `define("modernizr-init" ...)` and `define("modernizr-build" ...)`
|
||||
var mod = grunt.file.read(filepath).replace(/define\("modernizr-(init|build)", function\(\)\{\}\);/g, '');
|
||||
|
||||
// Hack the prefix into place. Anything is way to big for something so small.
|
||||
// Hack the prefix into place. Anything is way too big for something so small.
|
||||
if ( modConfig && modConfig.classPrefix ) {
|
||||
mod = mod.replace("classPrefix : '',", "classPrefix : '" + modConfig.classPrefix.replace(/"/g, '\\"') + "',");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
/* DOC
|
||||
|
||||
Tests for server sent events aka eventsource.
|
||||
|
||||
*/
|
||||
define(['Modernizr'], function( Modernizr ) {
|
||||
Modernizr.addTest('eventsource', !!window.EventSource);
|
||||
|
||||
19
feature-detects/network/xhr-responsetype-arraybuffer.js
Normal file
19
feature-detects/network/xhr-responsetype-arraybuffer.js
Normal file
@@ -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'));
|
||||
});
|
||||
19
feature-detects/network/xhr-responsetype-blob.js
Normal file
19
feature-detects/network/xhr-responsetype-blob.js
Normal file
@@ -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'));
|
||||
});
|
||||
19
feature-detects/network/xhr-responsetype-document.js
Normal file
19
feature-detects/network/xhr-responsetype-document.js
Normal file
@@ -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'));
|
||||
});
|
||||
22
feature-detects/network/xhr-responsetype-json.js
Normal file
22
feature-detects/network/xhr-responsetype-json.js
Normal file
@@ -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'));
|
||||
});
|
||||
19
feature-detects/network/xhr-responsetype-text.js
Normal file
19
feature-detects/network/xhr-responsetype-text.js
Normal file
@@ -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'));
|
||||
});
|
||||
26
feature-detects/network/xhr-responsetype.js
Normal file
26
feature-detects/network/xhr-responsetype.js
Normal file
@@ -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;
|
||||
}()));
|
||||
});
|
||||
@@ -130,6 +130,12 @@
|
||||
"test/network/connection",
|
||||
"test/network/eventsource",
|
||||
"test/network/xhr2",
|
||||
"test/network/xhr-responsetype-arraybuffer",
|
||||
"test/network/xhr-responsetype-blob",
|
||||
"test/network/xhr-responsetype-document",
|
||||
"test/network/xhr-responsetype-json",
|
||||
"test/network/xhr-responsetype-text",
|
||||
"test/network/xhr-responsetype",
|
||||
"test/notification",
|
||||
"test/pagevisibility-api",
|
||||
"test/performance",
|
||||
|
||||
18
src/testXhrType.js
Normal file
18
src/testXhrType.js
Normal file
@@ -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;
|
||||
});
|
||||
Reference in New Issue
Block a user