Переглянути джерело

optimize RAM usage on Firefox (fix #379)

Gildas 6 роки тому
батько
коміт
8251f4ec92
1 змінених файлів з 1 додано та 9 видалено
  1. 1 9
      lib/single-file/single-file-core.js

+ 1 - 9
lib/single-file/single-file-core.js

@@ -2020,15 +2020,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
 		}
 
 		static removeCssComments(stylesheetContent) {
-			let start, end;
-			do {
-				start = stylesheetContent.indexOf("/*");
-				end = stylesheetContent.indexOf("*/", start + 2);
-				if (start != -1 && end != -1) {
-					stylesheetContent = stylesheetContent.substring(0, start) + stylesheetContent.substr(end + 2);
-				}
-			} while (start != -1 && end != -1);
-			return stylesheetContent;
+			return stylesheetContent.replace(/\/\*.+?\*\//g, "");
 		}
 
 		static wrapMediaQuery(stylesheetContent, mediaQuery) {