Преглед на файлове

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");
+						}
 					}
 				});
 			}