Created
October 8, 2013 18:00
-
-
Save tedw/6888794 to your computer and use it in GitHub Desktop.
Redraw pseudo elements in IE8 - http://stackoverflow.com/questions/9809351/
This file contains hidden or 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
// Check if IE8 or lower | |
isOldIE: document.documentElement.className.search('old-ie') >= 0, | |
// Force IE8 to redraw :before/:after pseudo elements | |
// http://stackoverflow.com/questions/9809351/ | |
redrawPseudoEls: function() { | |
var self = this; | |
if ( self.isOldIE ) { | |
console.log('redraw pseudo elements'); | |
var head = document.getElementsByTagName('head')[0], | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.styleSheet.cssText = ':before, :after {content: none !important}'; | |
head.appendChild( style ); | |
_.defer( function() { | |
head.removeChild( style ); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment