Просмотр исходного кода

optimize RAM usage on Firefox (fix #379)

Former-commit-id: 8251f4ec92baefc62e44e89b1abbb8dcf6bf4586
Gildas 6 лет назад
Родитель
Сommit
53de803aab
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) {