fis-kernel
Advanced tools
Comparing version 1.9.6 to 1.9.7
@@ -233,9 +233,18 @@ /* | ||
if(tag === 'link'){ | ||
var inline = ''; | ||
var isCssLink = /\srel\s*=\s*(['"]?)stylesheet\1(?=\s|\/?>)/i.test(m); | ||
var inline = '', isCssLink = false, isImportLink = false; | ||
var result = m.match(/\srel\s*=\s*('[^']+'|"[^"]+"|[^\s\/>]+)/i); | ||
if(result && result[1]){ | ||
var rel = result[1].replace(/^['"]|['"]$/g, '').toLowerCase(); | ||
isCssLink = rel === 'stylesheet'; | ||
isImportLink = rel === 'import'; | ||
} | ||
m = m.replace(/(\s(?:data-)?href\s*=\s*)('[^']+'|"[^"]+"|[^\s\/>]+)/ig, function(_, prefix, value){ | ||
if(isCssLink && isInline(fis.util.query(value))){ | ||
inline += '<style' + m.substring(5).replace(/\/(?=>$)/, '').replace(/\s+(?:charset|href|data-href|hreflang|rel|rev|sizes|target)\s*=\s*(?:'[^']+'|"[^"]+"|[^\s\/>]+)/ig, ''); | ||
if((isCssLink || isImportLink) && isInline(fis.util.query(value))){ | ||
if(isCssLink) { | ||
inline += '<style' + m.substring(5).replace(/\/(?=>$)/, '').replace(/\s+(?:charset|href|data-href|hreflang|rel|rev|sizes|target)\s*=\s*(?:'[^']+'|"[^"]+"|[^\s\/>]+)/ig, ''); | ||
} | ||
inline += map.embed.ld + value + map.embed.rd; | ||
inline += '</style>'; | ||
if(isCssLink) { | ||
inline += '</style>'; | ||
} | ||
return ''; | ||
@@ -242,0 +251,0 @@ } else { |
{ | ||
"name" : "fis-kernel", | ||
"description" : "fis kernel.", | ||
"version" : "1.9.6", | ||
"version" : "1.9.7", | ||
"author" : "FIS Team <fis@baidu.com>", | ||
@@ -6,0 +6,0 @@ "homepage" : "http://fis.baidu.com/", |
75404
2268