htmllint
Version:
An unofficial html5 linter.
14 lines (11 loc) • 473 B
JavaScript
module.exports.isSelfClosing = function (element) {
var openRaw = element.open;
return openRaw[openRaw.length - 1] === '/';
};
// Check whether the given tag has a non-empty attribute with the given
// name. Count "" as a non-empty attribute value only if optional
// parameter allowNull is true,
module.exports.hasNonEmptyAttr = function(tag, attr, allowNull) {
var a = tag.attribs[attr];
return (a && (allowNull || (a.value && a.value.length > 0)));
};