From 62748b3b793fcd8dd5f30da7f924d0e74cf3e7f2 Mon Sep 17 00:00:00 2001 From: eight Date: Mon, 30 Oct 2017 01:22:10 +0800 Subject: [PATCH] Fix: use arrow function for IIFE --- background/usercss-helper.js | 2 +- edit/regexp-tester.js | 2 +- install-usercss/install-usercss.js | 2 +- js/localization.js | 2 +- js/moz-parser.js | 2 +- js/script-loader.js | 2 +- js/usercss.js | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/background/usercss-helper.js b/background/usercss-helper.js index 84c2e5e9..56c545cf 100644 --- a/background/usercss-helper.js +++ b/background/usercss-helper.js @@ -3,7 +3,7 @@ 'use strict'; // eslint-disable-next-line no-var -var usercssHelper = (function () { +var usercssHelper = (() => { function buildMeta(style) { if (style.usercssData) { return Promise.resolve(style); diff --git a/edit/regexp-tester.js b/edit/regexp-tester.js index 60542552..dc33e53b 100644 --- a/edit/regexp-tester.js +++ b/edit/regexp-tester.js @@ -3,7 +3,7 @@ 'use strict'; // eslint-disable-next-line no-var -var regExpTester = (function () { +var regExpTester = (() => { const GET_FAVICON_URL = 'https://www.google.com/s2/favicons?domain='; const OWN_ICON = chrome.runtime.getManifest().icons['16']; const cachedRegexps = new Map(); diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index e736081d..7f4436d2 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -2,7 +2,7 @@ 'use strict'; -(function () { +(() => { const params = getParams(); let liveReload = false; let installed = false; diff --git a/js/localization.js b/js/localization.js index bcce2c15..79b242e9 100644 --- a/js/localization.js +++ b/js/localization.js @@ -103,7 +103,7 @@ function tNodeList(nodes) { function tDocLoader() { t.DOMParser = new DOMParser(); - t.cache = (function () { + t.cache = (() => { try { return JSON.parse(localStorage.L10N); } catch (e) {} diff --git a/js/moz-parser.js b/js/moz-parser.js index 251181e1..fe6a3030 100644 --- a/js/moz-parser.js +++ b/js/moz-parser.js @@ -3,7 +3,7 @@ 'use strict'; // eslint-disable-next-line no-var -var mozParser = (function () { +var mozParser = (() => { // direct & reverse mapping of @-moz-document keywords and internal property names const propertyToCss = {urls: 'url', urlPrefixes: 'url-prefix', domains: 'domain', regexps: 'regexp'}; const CssToProperty = {'url': 'urls', 'url-prefix': 'urlPrefixes', 'domain': 'domains', 'regexp': 'regexps'}; diff --git a/js/script-loader.js b/js/script-loader.js index f31677a2..a7030282 100644 --- a/js/script-loader.js +++ b/js/script-loader.js @@ -2,7 +2,7 @@ // loadScript(script: Array|string): Promise // eslint-disable-next-line no-var -var loadScript = (function () { +var loadScript = (() => { const cache = new Map(); function inject(file) { diff --git a/js/usercss.js b/js/usercss.js index 91956c03..1a637d79 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -3,7 +3,7 @@ 'use strict'; // eslint-disable-next-line no-var -var usercss = (function () { +var usercss = (() => { // true for global, false for private const METAS = { __proto__: null, @@ -99,7 +99,7 @@ var usercss = (function () { } }; - const colorParser = (function () { + const colorParser = (() => { const el = document.createElement('div'); // https://bugs.webkit.org/show_bug.cgi?id=14563 document.head.appendChild(el);