|
|
@@ -35,6 +35,7 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
const HTML_IMPORT_ATTRIBUTE_NAME = "data-single-file-import";
|
|
|
const INPUT_VALUE_ATTRIBUTE_NAME = "data-single-file-input-value";
|
|
|
const LAZY_SRC_ATTRIBUTE_NAME = "data-single-file-lazy-loaded-src";
|
|
|
+ const STYLESHEET_ATTRIBUTE_NAME = "data-single-file-stylesheet";
|
|
|
const IGNORED_REMOVED_TAG_NAMES = ["NOSCRIPT", "DISABLED-NOSCRIPT", "META", "LINK", "STYLE", "TITLE", "TEMPLATE", "SOURCE", "OBJECT", "SCRIPT"];
|
|
|
const REGEXP_SIMPLE_QUOTES_STRING = /^'(.*?)'$/;
|
|
|
const REGEXP_DOUBLE_QUOTES_STRING = /^"(.*?)"$/;
|
|
|
@@ -58,7 +59,8 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
INPUT_VALUE_ATTRIBUTE_NAME,
|
|
|
SHADOW_ROOT_ATTRIBUTE_NAME,
|
|
|
HTML_IMPORT_ATTRIBUTE_NAME,
|
|
|
- LAZY_SRC_ATTRIBUTE_NAME
|
|
|
+ LAZY_SRC_ATTRIBUTE_NAME,
|
|
|
+ STYLESHEET_ATTRIBUTE_NAME
|
|
|
};
|
|
|
|
|
|
function initDoc(doc) {
|
|
|
@@ -287,6 +289,7 @@ this.singlefile.lib.helper = this.singlefile.lib.helper || (() => {
|
|
|
const stylesheet = tempStyleElement.sheet;
|
|
|
tempStyleElement.remove();
|
|
|
if (!stylesheet || stylesheet.cssRules.length != styleElement.sheet.cssRules.length) {
|
|
|
+ styleElement.setAttribute(STYLESHEET_ATTRIBUTE_NAME, styleIndex);
|
|
|
contents[styleIndex] = Array.from(styleElement.sheet.cssRules).map(cssRule => cssRule.cssText).join("\n");
|
|
|
}
|
|
|
} catch (error) {
|