Optimize: Use .hasOwnProperty to check cssRules accessibility

This commit is contained in:
uncelbill
2018-05-26 13:24:28 +08:00
committed by RedHoodSu
parent 71ae5d02a3
commit 8227abe686

View File

@@ -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) =>
{