Skip to content

Commit

Permalink
Initial stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanseddon committed Oct 8, 2011
1 parent 3739fe5 commit fb04fd0
Show file tree
Hide file tree
Showing 38 changed files with 12,780 additions and 12,780 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1 +1 @@
modernizr.min.js
modernizr.min.js
54 changes: 27 additions & 27 deletions README.md
@@ -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/)
24 changes: 12 additions & 12 deletions compress.sh
@@ -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
18 changes: 9 additions & 9 deletions feature-detects/css-boxsizing.js
@@ -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");
});

56 changes: 28 additions & 28 deletions feature-detects/css-displaytable.js
@@ -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;
});
20 changes: 10 additions & 10 deletions feature-detects/css-userselect.js
@@ -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");
});
22 changes: 11 additions & 11 deletions feature-detects/dom-createElement-attrs.js
@@ -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;
}
});
40 changes: 20 additions & 20 deletions feature-detects/elem-details.js
@@ -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;
});
38 changes: 19 additions & 19 deletions feature-detects/forms-placeholder.js
@@ -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');

}

})();
44 changes: 22 additions & 22 deletions feature-detects/img-webp.js
@@ -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';

})();
16 changes: 8 additions & 8 deletions feature-detects/window-framed.js
@@ -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;
});
4 changes: 2 additions & 2 deletions feature-detects/workers-sharedworkers.js
@@ -1,3 +1,3 @@
Modernizr.addTest('sharedworkers', function(){
return !!window.SharedWorker;
Modernizr.addTest('sharedworkers', function(){
return !!window.SharedWorker;
});

0 comments on commit fb04fd0

Please sign in to comment.