Преглед изворни кода

improved handling of hidden elements (fix #486)

Gildas пре 5 година
родитељ
комит
5cd8e586fd
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      lib/single-file/single-file-core.js

+ 6 - 2
lib/single-file/single-file-core.js

@@ -838,8 +838,12 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 				styleElement.textContent = ".sf-hidden{display:none!important;}";
 				this.doc.head.appendChild(styleElement);
 				hiddenElements.forEach(element => {
-					if (element.style.display != "none") {
-						element.classList.add("sf-hidden");
+					if (element.style.getPropertyValue("display") != "none") {
+						if (element.style.getPropertyPriority("display") == "important") {
+							element.style.setProperty("display", "none", "important");
+						} else {
+							element.classList.add("sf-hidden");
+						}
 					}
 				});
 			}