forked from Modernizr/Modernizr
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3739fe5
commit fb04fd0
Showing
38 changed files
with
12,780 additions
and
12,780 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
modernizr.min.js | ||
modernizr.min.js |
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
Modernizr | ||
========= | ||
|
||
### a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers | ||
|
||
Modernizr is a script that will detect native CSS3 and HTML5 features | ||
available in the current UA and provide an object containing all | ||
features with a true/false value, depending on whether the UA has | ||
native support for it or not. | ||
|
||
In addition to that, Modernizr will add classes to the `<html>` | ||
element of the page, one for each cutting-edge feature. If the UA | ||
supports it, a class like `cssgradients` will be added. If not, | ||
the class name will be `no-cssgradients`. This allows for simple | ||
if-conditionals in CSS styling, making it easily to have fine | ||
control over the look and feel of your website. | ||
|
||
Modernizr is dual-licensed under the BSD and MIT licenses. | ||
|
||
[http://www.modernizr.com/](http://www.modernizr.com/) | ||
|
||
|
||
##### Try it out: | ||
|
||
Run the library: [http://modernizr.github.com/Modernizr/output.html](http://modernizr.github.com/Modernizr/output.html) | ||
|
||
Run the test suite: [http://modernizr.github.com/Modernizr/test/](http://modernizr.github.com/Modernizr/test/) | ||
Modernizr | ||
========= | ||
|
||
### a JavaScript library allowing you to use CSS3 & HTML5 while maintaining control over unsupported browsers | ||
|
||
Modernizr is a script that will detect native CSS3 and HTML5 features | ||
available in the current UA and provide an object containing all | ||
features with a true/false value, depending on whether the UA has | ||
native support for it or not. | ||
|
||
In addition to that, Modernizr will add classes to the `<html>` | ||
element of the page, one for each cutting-edge feature. If the UA | ||
supports it, a class like `cssgradients` will be added. If not, | ||
the class name will be `no-cssgradients`. This allows for simple | ||
if-conditionals in CSS styling, making it easily to have fine | ||
control over the look and feel of your website. | ||
|
||
Modernizr is dual-licensed under the BSD and MIT licenses. | ||
|
||
[http://www.modernizr.com/](http://www.modernizr.com/) | ||
|
||
|
||
##### Try it out: | ||
|
||
Run the library: [http://modernizr.github.com/Modernizr/output.html](http://modernizr.github.com/Modernizr/output.html) | ||
|
||
Run the test suite: [http://modernizr.github.com/Modernizr/test/](http://modernizr.github.com/Modernizr/test/) |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#/bin/bash | ||
|
||
IN=modernizr.js | ||
OUT=modernizr.min.js | ||
|
||
SIZE_MIN=$(uglifyjs "$IN" --extra --unsafe | tee "$OUT" | wc -c) | ||
SIZE_GZIP=$(gzip -nfc --best "$OUT" | wc -c) | ||
|
||
echo $SIZE_MIN bytes minified, $SIZE_GZIP bytes gzipped | ||
|
||
if [ "$1" == "--test" ]; then | ||
rm "$OUT" | ||
#/bin/bash | ||
|
||
IN=modernizr.js | ||
OUT=modernizr.min.js | ||
|
||
SIZE_MIN=$(uglifyjs "$IN" --extra --unsafe | tee "$OUT" | wc -c) | ||
SIZE_GZIP=$(gzip -nfc --best "$OUT" | wc -c) | ||
|
||
echo $SIZE_MIN bytes minified, $SIZE_GZIP bytes gzipped | ||
|
||
if [ "$1" == "--test" ]; then | ||
rm "$OUT" | ||
fi |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
|
||
// developer.mozilla.org/en/CSS/box-sizing | ||
// github.com/Modernizr/Modernizr/issues/248 | ||
|
||
Modernizr.addTest("boxsizing",function(){ | ||
return Modernizr.testAllProps("box-sizing"); | ||
}); | ||
|
||
|
||
|
||
// developer.mozilla.org/en/CSS/box-sizing | ||
// github.com/Modernizr/Modernizr/issues/248 | ||
|
||
Modernizr.addTest("boxsizing",function(){ | ||
return Modernizr.testAllProps("box-sizing"); | ||
}); | ||
|
||
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
// display: table and table-cell test. (both are tested under one name "table-cell" ) | ||
// By @scottjehl | ||
|
||
// all additional table display values are here: http://pastebin.com/Gk9PeVaQ though Scott has seen some IE false positives with that sort of weak detection. | ||
// more testing neccessary perhaps. | ||
|
||
Modernizr.addTest( "display-table",function(){ | ||
|
||
var doc = window.document, | ||
docElem = doc.documentElement, | ||
parent = doc.createElement( "div" ), | ||
child = doc.createElement( "div" ), | ||
childb = doc.createElement( "div" ), | ||
ret; | ||
|
||
parent.style.display = "table"; | ||
child.style.display = childb.style.display = "table-cell"; | ||
child.style.padding = childb.style.padding = "10px"; | ||
|
||
parent.appendChild( child ); | ||
parent.appendChild( childb ); | ||
docElem.insertBefore( parent, docElem.firstChild ); | ||
|
||
ret = child.offsetLeft < childb.offsetLeft; | ||
docElem.removeChild(parent); | ||
return ret; | ||
}); | ||
|
||
// display: table and table-cell test. (both are tested under one name "table-cell" ) | ||
// By @scottjehl | ||
|
||
// all additional table display values are here: http://pastebin.com/Gk9PeVaQ though Scott has seen some IE false positives with that sort of weak detection. | ||
// more testing neccessary perhaps. | ||
|
||
Modernizr.addTest( "display-table",function(){ | ||
|
||
var doc = window.document, | ||
docElem = doc.documentElement, | ||
parent = doc.createElement( "div" ), | ||
child = doc.createElement( "div" ), | ||
childb = doc.createElement( "div" ), | ||
ret; | ||
|
||
parent.style.display = "table"; | ||
child.style.display = childb.style.display = "table-cell"; | ||
child.style.padding = childb.style.padding = "10px"; | ||
|
||
parent.appendChild( child ); | ||
parent.appendChild( childb ); | ||
docElem.insertBefore( parent, docElem.firstChild ); | ||
|
||
ret = child.offsetLeft < childb.offsetLeft; | ||
docElem.removeChild(parent); | ||
return ret; | ||
}); | ||
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// -moz-user-select:none test. | ||
|
||
// by ryan seddon | ||
//https://github.com/Modernizr/Modernizr/issues/250 | ||
|
||
|
||
Modernizr.addTest("userselect",function(){ | ||
return Modernizr.testAllProps("user-select"); | ||
}); | ||
|
||
// -moz-user-select:none test. | ||
|
||
// by ryan seddon | ||
//https://github.com/Modernizr/Modernizr/issues/250 | ||
|
||
|
||
Modernizr.addTest("userselect",function(){ | ||
return Modernizr.testAllProps("user-select"); | ||
}); | ||
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// by james a rosen. | ||
// https://github.com/Modernizr/Modernizr/issues/258 | ||
|
||
Modernizr.addTest('createelement-attrs', function() { | ||
try { | ||
return document.createElement("<input name='test' />").getAttribute('name') == 'test'; | ||
} catch(e) { | ||
return false; | ||
} | ||
}); | ||
|
||
// by james a rosen. | ||
// https://github.com/Modernizr/Modernizr/issues/258 | ||
|
||
Modernizr.addTest('createelement-attrs', function() { | ||
try { | ||
return document.createElement("<input name='test' />").getAttribute('name') == 'test'; | ||
} catch(e) { | ||
return false; | ||
} | ||
}); | ||
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
// By @mathias, based on http://mths.be/axh | ||
Modernizr.addTest('details', function() { | ||
var doc = document, | ||
el = doc.createElement('details'), | ||
de = doc.documentElement, | ||
fake, | ||
root = doc.body || (function() { | ||
fake = true; | ||
return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild); | ||
}()), | ||
diff; | ||
el.innerHTML = '<summary>a</summary>b'; | ||
el.style.display = 'block'; | ||
root.appendChild(el); | ||
diff = el.offsetHeight; | ||
el.open = true; | ||
diff = diff != el.offsetHeight; | ||
root.removeChild(el); | ||
fake && root.parentNode.removeChild(root); | ||
return diff; | ||
// By @mathias, based on http://mths.be/axh | ||
Modernizr.addTest('details', function() { | ||
var doc = document, | ||
el = doc.createElement('details'), | ||
de = doc.documentElement, | ||
fake, | ||
root = doc.body || (function() { | ||
fake = true; | ||
return de.insertBefore(doc.createElement('body'), de.firstElementChild || de.firstChild); | ||
}()), | ||
diff; | ||
el.innerHTML = '<summary>a</summary>b'; | ||
el.style.display = 'block'; | ||
root.appendChild(el); | ||
diff = el.offsetHeight; | ||
el.open = true; | ||
diff = diff != el.offsetHeight; | ||
root.removeChild(el); | ||
fake && root.parentNode.removeChild(root); | ||
return diff; | ||
}); |
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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
|
||
// mostly by mathias bynens | ||
// https://github.com/mathiasbynens/Modernizr/commit/71932649b08e | ||
// but fixed by paul irish | ||
|
||
;(function(){ | ||
|
||
var inputElem = document.createElement('input'); | ||
|
||
Modernizr.input.placeholder = new Boolean('placeholder' in inputElem); | ||
|
||
if (Modernizr.input.placeholder){ | ||
|
||
Modernizr.input.placeholder.input = !!Modernizr.input.placeholder; | ||
Modernizr.input.placeholder.textarea = 'placeholder' in document.createElement('textarea'); | ||
|
||
} | ||
|
||
})(); | ||
|
||
// mostly by mathias bynens | ||
// https://github.com/mathiasbynens/Modernizr/commit/71932649b08e | ||
// but fixed by paul irish | ||
|
||
;(function(){ | ||
|
||
var inputElem = document.createElement('input'); | ||
|
||
Modernizr.input.placeholder = new Boolean('placeholder' in inputElem); | ||
|
||
if (Modernizr.input.placeholder){ | ||
|
||
Modernizr.input.placeholder.input = !!Modernizr.input.placeholder; | ||
Modernizr.input.placeholder.textarea = 'placeholder' in document.createElement('textarea'); | ||
|
||
} | ||
|
||
})(); |
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
// code.google.com/speed/webp/ | ||
// by rich bradshaw, ryan seddon, and paul irish | ||
|
||
|
||
// This test is ascynchronous. Watch out. | ||
|
||
(function(){ | ||
|
||
var image = new Image(); | ||
|
||
|
||
image.onerror = function() { | ||
Modernizr.addTest('webp', function () { return false; }); | ||
}; | ||
image.onload = function() { | ||
Modernizr.addTest('webp', function () { return image.width == 4; }); | ||
}; | ||
|
||
image.src = 'data:image/webp;base64,UklGRjgAAABXRUJQVlA4ICwAAAAQAgCdASoEAAQAAAcIhYWIhYSIgIIADA1gAAUAAAEAAAEAAP7%2F2fIAAAAA'; | ||
|
||
})(); | ||
|
||
// code.google.com/speed/webp/ | ||
// by rich bradshaw, ryan seddon, and paul irish | ||
|
||
|
||
// This test is ascynchronous. Watch out. | ||
|
||
(function(){ | ||
|
||
var image = new Image(); | ||
|
||
|
||
image.onerror = function() { | ||
Modernizr.addTest('webp', function () { return false; }); | ||
}; | ||
image.onload = function() { | ||
Modernizr.addTest('webp', function () { return image.width == 4; }); | ||
}; | ||
|
||
image.src = 'data:image/webp;base64,UklGRjgAAABXRUJQVlA4ICwAAAAQAgCdASoEAAQAAAcIhYWIhYSIgIIADA1gAAUAAAEAAAEAAP7%2F2fIAAAAA'; | ||
|
||
})(); | ||
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
|
||
// tests if page is iframed | ||
|
||
// github.com/Modernizr/Modernizr/issues/242 | ||
|
||
Modernizr.addTest('framed', function(){ | ||
return window.location != top.location; | ||
}); | ||
|
||
// tests if page is iframed | ||
|
||
// github.com/Modernizr/Modernizr/issues/242 | ||
|
||
Modernizr.addTest('framed', function(){ | ||
return window.location != top.location; | ||
}); |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Modernizr.addTest('sharedworkers', function(){ | ||
return !!window.SharedWorker; | ||
Modernizr.addTest('sharedworkers', function(){ | ||
return !!window.SharedWorker; | ||
}); |
Oops, something went wrong.