Bläddra i källkod

take into account the first valid meta[charset] tag

Gildas 7 år sedan
förälder
incheckning
ef1aac40ed
1 ändrade filer med 3 tillägg och 2 borttagningar
  1. 3 2
      lib/single-file/single-file-core.js

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

@@ -483,10 +483,11 @@ this.SingleFileCore = this.SingleFileCore || (() => {
 		}
 
 		resetCharsetMeta() {
+			let charSet;
 			this.doc.querySelectorAll("meta[charset], meta[http-equiv=\"content-type\"]").forEach(element => {
 				const charSetDeclaration = element.content.split(";")[1];
-				if (charSetDeclaration) {
-					const charSet = charSetDeclaration.split("=")[1];
+				if (charSetDeclaration && !charSet) {
+					charSet = charSetDeclaration.split("=")[1];
 					if (charSet) {
 						this.charSet = charSet.trim().toLowerCase();
 					}