From 713e4f2499a5048822dea95359f8b6baaf0c2a5a Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Fri, 21 Apr 2017 16:25:28 -0400 Subject: [PATCH] Use getAttribute instead --- cq-prolyfill.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cq-prolyfill.js b/cq-prolyfill.js index 407e957..2771cef 100644 --- a/cq-prolyfill.js +++ b/cq-prolyfill.js @@ -1221,11 +1221,9 @@ function filterRulesByElementAndProp(rules, element, prop) { if (element.id) { foundRules = foundRules.concat(rules['#' + element.id] || []); } - if (element.className) { - element.className.split(/\s+/).forEach(function(className) { - foundRules = foundRules.concat(rules['.' + className] || []); - }); - } + (element.getAttribute('class') || '').split(/\s+/).forEach(function(className) { + foundRules = foundRules.concat(rules['.' + className] || []); + }); foundRules = foundRules .concat(rules[element.tagName.toLowerCase()] || []) .concat(rules['*'] || []);