Created
November 7, 2014 14:36
-
-
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.
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
/** | |
* 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