Skip to content

Instantly share code, notes, and snippets.

@tedw
Created October 8, 2013 18:00
Show Gist options
  • Save tedw/6888794 to your computer and use it in GitHub Desktop.
Save tedw/6888794 to your computer and use it in GitHub Desktop.
Redraw pseudo elements in IE8 - http://stackoverflow.com/questions/9809351/
// 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