Skip to content

Instantly share code, notes, and snippets.

@schorfES
Created November 7, 2014 14:36
Show Gist options
  • Save schorfES/5048f3c4444d524050c1 to your computer and use it in GitHub Desktop.
Save schorfES/5048f3c4444d524050c1 to your computer and use it in GitHub Desktop.
Test if browser supports padding in elements which behave like tables and are positioned fixed.
/**
* Test if browser supports padding in elements which behave like tables
* and are positioned fixed.
*/
Modernizr.addTest('positionfixed-tablepadding', function(){
return Modernizr.testStyles('#modernizr', function(elem) {
var
doc = document,
outer = doc.createElement('div'),
inner = doc.createElement('div')
;
outer.style.position = 'fixed';
outer.style.display = 'table';
outer.style.padding = '100px 0';
inner.style.display = 'table-cell';
inner.style.height = '200px';
inner.text = 'test';
outer.appendChild(inner);
elem.appendChild(outer);
return outer.clientHeight === 400;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment