From 74d00f64047904b576ff94a7c20316028057ffc8 Mon Sep 17 00:00:00 2001 From: mcmimik Date: Fri, 16 Aug 2019 17:21:21 +0300 Subject: [PATCH] Cleaning up Removed duplicated variable declaration. Changed the comparison to strict. --- src/css-support.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/css-support.js b/src/css-support.js index 6c5bc5c..971872b 100644 --- a/src/css-support.js +++ b/src/css-support.js @@ -2,7 +2,7 @@ this.CSSTest || (this.CSSTest = (function(global) { var version = '0.4', - sheet, style, + sheet, doc = global.document, root = doc.documentElement, @@ -24,7 +24,7 @@ this.CSSTest || (this.CSSTest = (function(global) { // transform (p)roperty name to Camel Case (fontSize, lineHeight) var toCamelCase = function(p) { - if (p == 'float') { + if (p === 'float') { return 'styleFloat' in root.style ? 'styleFloat' : 'cssFloat' in root.style ? 'cssFloat' : p; } @@ -44,7 +44,7 @@ this.CSSTest || (this.CSSTest = (function(global) { try { sheet.insertRule(rule, 0); result = !(/unknown/i).test(sheet.cssRules[0].cssText);/* && - sheet.cssRules[0].cssText.replace(/[\s;\\\x22\x27]/g, '') == + sheet.cssRules[0].cssText.replace(/[\s;\\\x22\x27]/g, '') === rule.replace(/[\s;\\\x22\x27]/g, '');*/ sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } @@ -66,7 +66,7 @@ this.CSSTest || (this.CSSTest = (function(global) { try { sheet.insertRule(media, 0); result = !(/unknown/i).test(sheet.cssRules[0].cssText);/* && - sheet.cssRules[0].cssText.replace(/[\s;\\\x22\x27]/g, '') == + sheet.cssRules[0].cssText.replace(/[\s;\\\x22\x27]/g, '') === media.replace(/[\s;\\\x22\x27]/g, '');*/ sheet.deleteRule(sheet.cssRules.length - 1); } catch(e) { } @@ -103,7 +103,7 @@ this.CSSTest || (this.CSSTest = (function(global) { if (!property) return false; var result = false, prop = toCamelCase(property); if (!value && prop in root.style) { - return typeof root.style[prop] == 'string'; + return typeof root.style[prop] === 'string'; } else { if (!(sheet)) return false; try { @@ -123,8 +123,8 @@ this.CSSTest || (this.CSSTest = (function(global) { return sheet.cssText.indexOf(property.toUpperCase()) > - 1; } return name in root.style && - typeof root.style[name] == 'string' || - typeof root.style[name] == 'number'; + typeof root.style[name] === 'string' || + typeof root.style[name] === 'number'; } };