fixed ie8 not support

This commit is contained in:
lpyt 2016-09-29 12:57:41 +08:00 committed by GitHub
parent 28ed6fa374
commit bd8bbfff2a

View file

@ -61,7 +61,7 @@
style.appendChild(document.createTextNode('')); style.appendChild(document.createTextNode(''));
} }
document.getElementsByTagName('head')[0].appendChild(style); document.getElementsByTagName('head')[0].appendChild(style);
return style.sheet; return style.sheet || style.styleSheet;
}, },
removeStylesheet: function(id) { removeStylesheet: function(id) {
@ -71,7 +71,7 @@
insertCSSRule: function(sheet, selector, rules, index) { insertCSSRule: function(sheet, selector, rules, index) {
if (typeof sheet.insertRule === 'function') { if (typeof sheet.insertRule === 'function') {
sheet.insertRule(selector + '{' + rules + '}', index); sheet.insertRule(selector + '{' + rules + '}', index);
} else if (typeof sheet.addRule === 'function') { } else if (sheet.addRule) {
sheet.addRule(selector, rules, index); sheet.addRule(selector, rules, index);
} }
}, },