Explorar o código

fixed rare styling issue when saving selected content

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
ef4915b584
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      lib/single-file/single-file-core.js

+ 3 - 3
lib/single-file/single-file-core.js

@@ -958,7 +958,7 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		}
 
 		static isolateElements(rootElement) {
-			rootElement.querySelectorAll("*").forEach(element => {
+			rootElement.querySelectorAll("*:not(style)").forEach(element => {
 				if (element.getAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME) == "") {
 					element.removeAttribute(SELECTED_CONTENT_ATTRIBUTE_NAME);
 				} else if (!element.querySelector("[" + SELECTED_CONTENT_ATTRIBUTE_NAME + "]")) {
@@ -970,13 +970,13 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			function isolateParentElements(parentElement, element) {
 				if (parentElement) {
 					Array.from(parentElement.childNodes).forEach(node => {
-						if (node != element && node.tagName != "HEAD" && node.tagName != "STYLE") {
+						if (node != element && node.tagName != "STYLE") {
 							node.remove();
 						}
 					});
 				}
 				element = element.parentElement;
-				if (element && element.parentElement) {
+				if (element && element.parentElement && element.parentElement.tagName != "BODY") {
 					isolateParentElements(element.parentElement, element);
 				}
 			}