Explorar o código

don't reset style of selected contents

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

+ 1 - 1
extension/core/content/content.js

@@ -125,7 +125,7 @@ this.singlefile.top = this.singlefile.top || (() => {
 		let selectionFound = false;
 		const ancestorElement = range.commonAncestorContainer != Node.ELEMENT_NODE ? range.commonAncestorContainer.parentElement : range.commonAncestorContainer;
 		ancestorElement.setAttribute(SELECTED_CONTENT_ROOT_ATTRIBUTE_NAME, "");
-		while (treeWalker.nextNode() && treeWalker.currentNode != range.endContainer) {
+		while (treeWalker.nextNode() && treeWalker.currentNode != range.endContainer) {			
 			if (treeWalker.currentNode == range.startContainer) {
 				selectionFound = true;
 			}

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

@@ -546,13 +546,8 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 			function isolateParentElements(parentElement, element) {
 				if (parentElement) {
 					Array.from(parentElement.childNodes).forEach(node => {
-						if (node == element) {
-							node.removeAttribute("style");
-							node.style.all = "unset";
-						} else {
-							if (node.tagName != "HEAD" && node.tagName != "STYLE") {
-								node.remove();
-							}
+						if (node != element && node.tagName != "HEAD" && node.tagName != "STYLE") {
+							node.remove();
 						}
 					});
 				}