From cbaee21deddf4a568de3a408c74a380a383ef88a Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Tue, 7 Feb 2017 19:54:09 +0800 Subject: [PATCH] fix: css var polyfill --- CHANGELOG.md | 4 ++++ src/polyfill.js | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef22f2903..10c17150d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.3 +### Bug fixes +- fix: css var polyfill + ## 2.0.2 ### Bug fixes diff --git a/src/polyfill.js b/src/polyfill.js index 551499b7f..d2418a271 100644 --- a/src/polyfill.js +++ b/src/polyfill.js @@ -14,14 +14,17 @@ export function cssVars () { if (block.nodeName === 'STYLE') { replaceVar(block) } else if (block.nodeName === 'LINK') { - load(block.getAttribute('href')) - .then(res => { - const style = document.createElement('style') + const href = block.getAttribute('href') - style.innerHTML = res - document.head.appendChild(style) - replaceVar(style) - }) + if (/\.css$/.test(href)) return + + load(href).then(res => { + const style = document.createElement('style') + + style.innerHTML = res + document.head.appendChild(style) + replaceVar(style) + }) } }) }