From 8227abe68605487c65c43d4bf5cf5358a1ac5604 Mon Sep 17 00:00:00 2001 From: uncelbill Date: Sat, 26 May 2018 13:24:28 +0800 Subject: [PATCH] Optimize: Use .hasOwnProperty to check cssRules accessibility --- src/Elements/CssStore.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Elements/CssStore.js b/src/Elements/CssStore.js index a183494..fa80f2b 100644 --- a/src/Elements/CssStore.js +++ b/src/Elements/CssStore.js @@ -46,14 +46,8 @@ export default class CssStore each(document.styleSheets, (styleSheet) => { - try - { - // Started with version 64, Chrome does not allow cross origin script to access this property. - if (!styleSheet.cssRules) return; - } catch (e) - { - return; - } + // Started with version 64, Chrome does not allow cross origin script to access this property. + if (!styleSheet.hasOwnProperty('cssRules')) return; each(styleSheet.cssRules, (cssRule) => {