Parcourir la source

fixed issues with inlined stylesheets for media != all

Gildas il y a 7 ans
Parent
commit
161c02a3be

+ 1 - 1
lib/single-file/css-rules-matcher.js

@@ -47,7 +47,7 @@ this.RulesMatcher = this.RulesMatcher || (() => {
 					let cssRules = styleElement.sheet.cssRules;
 					if (styleElement.media && styleElement.media != MEDIA_ALL) {
 						const mediaInfo = createMediaInfo(styleElement.media);
-						this.mediaAllInfo.medias.set("style-" + sheetIndex + "-" + styleElement.media.mediaText, mediaInfo);
+						this.mediaAllInfo.medias.set("style-" + sheetIndex + "-" + styleElement.media, mediaInfo);
 						getMatchedElementsRules(doc, cssRules, mediaInfo, sheetIndex, matchedElementsCache);
 					} else {
 						getMatchedElementsRules(doc, cssRules, this.mediaAllInfo, sheetIndex, matchedElementsCache);

+ 1 - 1
lib/single-file/css-rules-minifier.js

@@ -32,7 +32,7 @@ this.cssMinifier = this.cssMinifier || (() => {
 					const cssRules = styleElement.sheet.cssRules;
 					let mediaInfo;
 					if (styleElement.media && styleElement.media != "all") {
-						mediaInfo = mediaAllInfo.medias.get("style-" + sheetIndex + "-" + styleElement.media.mediaText);
+						mediaInfo = mediaAllInfo.medias.get("style-" + sheetIndex + "-" + styleElement.media);
 					} else {
 						mediaInfo = mediaAllInfo;
 					}

+ 1 - 1
lib/single-file/html-images-minifier.js

@@ -65,7 +65,7 @@ this.imagesMinifier = this.imagesMinifier || (() => {
 				const cssRules = styleElement.sheet.cssRules;
 				let mediaInfo;
 				if (styleElement.media && styleElement.media != "all") {
-					mediaInfo = mediaAllInfo.medias.get(sheetIndex + "-" + styleElement.media);
+					mediaInfo = mediaAllInfo.medias.get("style-" + sheetIndex + "-" + styleElement.media);
 				} else {
 					mediaInfo = mediaAllInfo;
 				}