From d8058f5f91907ca6a69e18001fd7ddd8af50e80d Mon Sep 17 00:00:00 2001 From: sknebel Date: Sat, 3 Jun 2017 20:54:55 +0200 Subject: [PATCH] handle empty attributes better --- lib/domutils.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/domutils.js b/lib/domutils.js index e4b1f57..26eeced 100644 --- a/lib/domutils.js +++ b/lib/domutils.js @@ -257,17 +257,14 @@ var Modules = (function (modules) { var i = tagNames.length; while(i--) { - if(node.name === tagNames[i]) { - var attr = this.getAttribute(node, attributeName); - if(attr && attr !== '') { - return attr; - } + if(node.tagName.toLowerCase() === tagNames[i]) { + if (this.hasAttribute(node, attributeName)) + return this.getAttribute(node, attributeName); } } return null; }, - /** * get node if has no siblings CSS :only-child *