Bläddra i källkod

use String#includes instead of String#indexOf

Gildas 7 år sedan
förälder
incheckning
41a8efbf04
2 ändrade filer med 2 tillägg och 2 borttagningar
  1. 1 1
      lib/frame-tree/frame-tree.js
  2. 1 1
      lib/single-file/single-file-browser.js

+ 1 - 1
lib/frame-tree/frame-tree.js

@@ -217,7 +217,7 @@ this.frameTree = this.frameTree || (() => {
 			if (contentType) {
 				const matchContentType = contentType.toLowerCase().split(";");
 				mimeType = matchContentType[0].trim();
-				if (mimeType.indexOf("/") <= 0) {
+				if (!mimeType.includes("/")) {
 					mimeType = "text/html";
 				}
 				const charsetValue = matchContentType[1] && matchContentType[1].trim();

+ 1 - 1
lib/single-file/single-file-browser.js

@@ -101,7 +101,7 @@ this.SingleFileBrowser = this.SingleFileBrowser || (() => {
 		if (contentType) {
 			const matchContentType = contentType.toLowerCase().split(";");
 			contentType = matchContentType[0].trim();
-			if (contentType.indexOf("/") <= 0) {
+			if (!contentType.includes("/")) {
 				contentType = null;
 			}
 			const charsetValue = matchContentType[1] && matchContentType[1].trim();