Explorar el Código

improved handling of hidden elements (fix #486)

Gildas hace 5 años
padre
commit
5cd8e586fd
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  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");
+						}
 					}
 				});
 			}