Parcourir la source

take into account the first valid meta[charset] tag

Gildas il y a 7 ans
Parent
commit
ef1aac40ed
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  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();
 					}