|
|
@@ -106,6 +106,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
}, {
|
|
|
sync: [
|
|
|
{ option: "lazyLoadImages", action: "lazyLoadImages" },
|
|
|
+ { option: "removeSrcSet", action: "removeSrcSet" },
|
|
|
{ option: "removeAlternativeFonts", action: "postRemoveAlternativeFonts" }
|
|
|
],
|
|
|
async: [
|
|
|
@@ -393,6 +394,25 @@ this.SingleFileCore = this.SingleFileCore || (() => {
|
|
|
DOM.minifyFonts(this.doc);
|
|
|
}
|
|
|
|
|
|
+ removeSrcSet() {
|
|
|
+ this.doc.querySelectorAll("[srcset]").forEach(element => {
|
|
|
+ const tagName = element.tagName.toLowerCase();
|
|
|
+ if (tagName == "source") {
|
|
|
+ const parentElement = element.parentElement;
|
|
|
+ if (parentElement.tagName.toLowerCase() == "picture") {
|
|
|
+ const imageElement = parentElement.querySelector("img");
|
|
|
+ if (imageElement && imageElement.src) {
|
|
|
+ element.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (tagName == "img" && element.src) {
|
|
|
+ element.removeAttribute("srcset");
|
|
|
+ element.removeAttribute("sizes");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
postRemoveAlternativeFonts() {
|
|
|
DOM.minifyFonts(this.doc, true);
|
|
|
if (this.options.compressCSS) {
|