single-file-core 1.5.55 → 1.5.57

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.
package/core/index.js CHANGED
@@ -893,7 +893,8 @@ class Processor {
893
893
  if (!this.options.saveFavicon) {
894
894
  this.doc.querySelectorAll("link[rel*=\"icon\"]").forEach(element => element.remove());
895
895
  }
896
- this.doc.querySelectorAll("a[ping]").forEach(element => element.removeAttribute("ping"));
896
+ this.doc.querySelectorAll("a[ping], area[ping]").forEach(element => element.removeAttribute("ping"));
897
+ this.doc.querySelectorAll("a[attributionsrc], img[attributionsrc], script[attributionsrc]").forEach(element => element.removeAttribute("attributionsrc"));
897
898
  this.doc.querySelectorAll("link[rel=import][href]").forEach(element => element.remove());
898
899
  }
899
900
 
@@ -247,9 +247,9 @@ function getProcessorHelperClass(utilInstance) {
247
247
 
248
248
  async processFrame(frameElement, pageData, options, resources, frameWindowId, frameData) {
249
249
  const name = "frames/" + resources.frames.size + "/";
250
- let sandbox = "allow-popups allow-top-navigation-by-user-activation";
250
+ let sandbox = "allow-popups allow-top-navigation-by-user-activation allow-scripts";
251
251
  if (pageData.content.match(NOSCRIPT_TAG_FOUND) || pageData.content.match(CANVAS_TAG_FOUND) || pageData.content.match(SCRIPT_TAG_FOUND) || options.saveRawPage) {
252
- sandbox += " allow-scripts allow-modals allow-popups allow-downloads allow-pointer-lock allow-presentation";
252
+ sandbox += " allow-modals allow-popups allow-downloads allow-pointer-lock allow-presentation";
253
253
  }
254
254
  frameElement.setAttribute("sandbox", sandbox);
255
255
  if (frameElement.tagName.toUpperCase() == "OBJECT") {
@@ -217,7 +217,7 @@ function minifyRule(ruleData, cssRule, stylesheets, processingContext, removedRu
217
217
  }
218
218
  }
219
219
 
220
- function minifyImportRule(ruleData, cssRule, stylesheets, processingContext, removedRules, docContext) {
220
+ function minifyImportRule(ruleData, _cssRule, stylesheets, processingContext, _removedRules, docContext) {
221
221
  const urlNode = ruleData.prelude.children.head.data;
222
222
  const topConditionalStack = urlNode.importedMediaText ? [{ name: "media", prelude: urlNode.importedMediaText }] : [];
223
223
  if (urlNode.importedLayerName !== undefined) {
@@ -417,8 +417,12 @@ function collectDeclarationItemsForElement(element, docContext) {
417
417
  const { type, value } = declaration.data;
418
418
  if (type === DECLARATION_TYPE && value) {
419
419
  const isRawValue = value.type === RAW_TYPE;
420
- const isVendorValue = value.type === VALUE_TYPE && hasChildNodes(value) && value.children.head.data.name && value.children.head.data.name.startsWith(VENDOR_PREFIX);
421
- const isInvalidValue = value.type === VALUE_TYPE && hasChildNodes(value) && value.children.head.data.name && INVALID_CSS_ESCAPE_TEST.test(value.children.head.data.name);
420
+ const isSingleValue = value.type === VALUE_TYPE &&
421
+ hasChildNodes(value) &&
422
+ value.children.length == 1 &&
423
+ value.children.head.data.name;
424
+ const isVendorValue = isSingleValue && value.children.head.data.name.startsWith(VENDOR_PREFIX);
425
+ const isInvalidValue = isSingleValue && INVALID_CSS_ESCAPE_TEST.test(value.children.head.data.name);
422
426
  if (!isRawValue && !isVendorValue && !isInvalidValue) {
423
427
  allDeclarations.push({
424
428
  declaration,
@@ -590,8 +594,8 @@ function compareDeclarations(declarationA, declarationB, docContext) {
590
594
  }
591
595
  if (declarationA.isInline && !declarationB.isInline) return 1;
592
596
  if (!declarationA.isInline && declarationB.isInline) return -1;
593
- let selectorDataA = declarationA.selector ? docContext.selectorData.get(declarationA.selector) : null;
594
- let selectorDataB = declarationB.selector ? docContext.selectorData.get(declarationB.selector) : null;
597
+ const selectorDataA = declarationA.selector ? docContext.selectorData.get(declarationA.selector) : null;
598
+ const selectorDataB = declarationB.selector ? docContext.selectorData.get(declarationB.selector) : null;
595
599
  if (selectorDataA && selectorDataB) {
596
600
  const layerComparison = compareLayers(selectorDataA.layerStack, selectorDataB.layerStack, docContext);
597
601
  if (layerComparison !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.55",
3
+ "version": "1.5.57",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -439,7 +439,7 @@ function getFrames(document) {
439
439
  document.querySelectorAll(ALL_ELEMENTS_CSS_SELECTOR).forEach(element => {
440
440
  const shadowRoot = helper.getShadowRoot(element);
441
441
  if (shadowRoot) {
442
- frames = frames.concat(...shadowRoot.querySelectorAll(FRAMES_CSS_SELECTOR));
442
+ frames = frames.concat(...getFrames(shadowRoot));
443
443
  }
444
444
  });
445
445
  return frames;
@@ -52,12 +52,16 @@
52
52
  const BOOTSTRAP_EVENT = "single-file-bootstrap";
53
53
  const FONT_STYLE_PROPERTIES = {
54
54
  family: "font-family",
55
- style: "font-style",
56
- weight: "font-weight",
55
+ ascentOverride: "ascent-override",
56
+ descentOverride: "descent-override",
57
+ display: "font-display",
58
+ featureSettings: "font-feature-settings",
59
+ lineGapOverride: "line-gap-override",
57
60
  stretch: "font-stretch",
61
+ style: "font-style",
58
62
  unicodeRange: "unicode-range",
59
- variant: "font-variant",
60
- featureSettings: "font-feature-settings"
63
+ variationSettings: "font-variation-settings",
64
+ weight: "font-weight"
61
65
  };
62
66
 
63
67
  const fetch = globalThis.fetch.bind(globalThis);