Skip to content

Commit

Permalink
Merge pull request Modernizr#485 from aFarkas/master
Browse files Browse the repository at this point in the history
modernizr2.5.1 fixes
  • Loading branch information
Alexander Farkas committed Feb 6, 2012
2 parents 139e537 + fb36e3c commit 138d3a7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion feature-detects/css-remunit.js
Expand Up @@ -11,7 +11,9 @@
Modernizr.addTest('cssremunit', function(){

var div = document.createElement('div');
div.style.fontSize = '3rem';
try {
div.style.fontSize = '3rem';
} catch(er){}
return /rem/.test(div.style.fontSize)

});
2 changes: 1 addition & 1 deletion feature-detects/quota-management-api.js
Expand Up @@ -8,5 +8,5 @@

Modernizr.addTest('quotamanagement', function(){
var storage = Modernizr.prefixed('StorageInfo', window);
return !!('TEMPORARY' in storage && 'PERSISTENT' in storage);
return !!(storage && 'TEMPORARY' in storage && 'PERSISTENT' in storage);
});
7 changes: 6 additions & 1 deletion modernizr.js
Expand Up @@ -76,6 +76,8 @@ window.Modernizr = (function( window, document, undefined ) {

classes = [],

slice = classes.slice,

featureName, // used in testing loop


Expand Down Expand Up @@ -110,7 +112,9 @@ window.Modernizr = (function( window, document, undefined ) {
// Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
fakeBody.innerHTML += style;
fakeBody.appendChild(div);
docElement.appendChild(fakeBody);
if(!body){
docElement.appendChild(fakeBody);
}

ret = callback(div, rule);
// If this is done after page load we don't want to remove the body so check if body exists
Expand Down Expand Up @@ -205,6 +209,7 @@ window.Modernizr = (function( window, document, undefined ) {
// http://es5.github.com/#x15.3.4.5

if (!Function.prototype.bind) {

Function.prototype.bind = function bind(that) {

var target = this;
Expand Down
11 changes: 11 additions & 0 deletions test/js/unit.js
Expand Up @@ -27,7 +27,18 @@ test("globals set up", function() {

});

test("bind is implemented", function() {

ok(Function.prototype.bind, 'bind is a member of Function.prototype');

var a = function(){
return this.modernizr;
};
a = a.bind({modernizr: 'just awsome'});

equals("just awsome", a(), 'bind works as expected');

});



Expand Down

0 comments on commit 138d3a7

Please sign in to comment.