single-file-core 1.0.49 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -115,7 +115,7 @@ function getMatchedElementsRules(doc, cssRules, mediaInfo, sheetIndex, styles, m
|
|
|
115
115
|
const selectors = ruleData.prelude.children.toArray();
|
|
116
116
|
const selectorsText = ruleData.prelude.children.toArray().map(selector => cssTree.generate(selector));
|
|
117
117
|
const ruleInfo = { ruleData, mediaInfo, ruleIndex, sheetIndex, matchedSelectors: new Set(), declarations: new Set(), selectors, selectorsText };
|
|
118
|
-
if (!invalidSelector(selectorsText.join(","), workStylesheet)) {
|
|
118
|
+
if (!invalidSelector(selectorsText.join(","), workStylesheet) || selectorsText.find(selectorText => selectorText.includes("|"))) {
|
|
119
119
|
for (let selector = ruleData.prelude.children.head, selectorIndex = 0; selector; selector = selector.next, selectorIndex++) {
|
|
120
120
|
const selectorText = selectorsText[selectorIndex];
|
|
121
121
|
const selectorInfo = { selector, selectorText, ruleInfo };
|
|
@@ -174,6 +174,10 @@ function getMatchedElementsSelector(doc, selectorInfo, styles, matchedElementsCa
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
function getFilteredSelector(selector, selectorText) {
|
|
177
|
+
const namespaceSeparatorIndex = selectorText.lastIndexOf("|");
|
|
178
|
+
if (namespaceSeparatorIndex > -1) {
|
|
179
|
+
return selectorText.substring(namespaceSeparatorIndex + 1);
|
|
180
|
+
}
|
|
177
181
|
const removedSelectors = [];
|
|
178
182
|
selector = { data: cssTree.parse(cssTree.generate(selector.data), { context: "selector" }) };
|
|
179
183
|
filterPseudoClasses(selector);
|
package/package.json
CHANGED
package/single-file-core.js
CHANGED
|
@@ -733,7 +733,7 @@ class Processor {
|
|
|
733
733
|
noscriptPlaceholders.set(placeholderElement, noscriptElement);
|
|
734
734
|
});
|
|
735
735
|
this.doc.querySelectorAll("meta[http-equiv=refresh], meta[disabled-http-equiv]").forEach(element => element.remove());
|
|
736
|
-
|
|
736
|
+
noscriptPlaceholders.forEach((noscriptElement, placeholderElement) => {
|
|
737
737
|
noscriptElement.dataset.singleFileDisabledNoscript = placeholderElement.innerHTML;
|
|
738
738
|
placeholderElement.replaceWith(noscriptElement);
|
|
739
739
|
});
|
package/single-file-helper.js
CHANGED
|
@@ -438,7 +438,7 @@ function postProcessDoc(doc, markedElements, invalidElements) {
|
|
|
438
438
|
element.removeAttribute(STYLE_ATTRIBUTE_NAME);
|
|
439
439
|
});
|
|
440
440
|
if (invalidElements) {
|
|
441
|
-
|
|
441
|
+
invalidElements.forEach((placeholderElement, element) => placeholderElement.replaceWith(element));
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
|