Skip to content

Instantly share code, notes, and snippets.

@Jayphen
Created September 21, 2011 05:30
Show Gist options
  • Save Jayphen/1231327 to your computer and use it in GitHub Desktop.
Save Jayphen/1231327 to your computer and use it in GitHub Desktop.
Modernizr box-sizing check
Modernizr.addTest('box-sizing', function() {
var test = document.createElement('div'),
root = document.documentElement.appendChild(document.createElement('body'));
test.style.cssText = '-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;padding:0 10px;margin:0;border:0;position:absolute;top:0;left:0;width:100px';
root.appendChild(test);
var ret = test.offsetWidth === 100;
root.removeChild(test);
document.documentElement.removeChild(root);
return ret;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment