How to use the domutils.hasAttrib function in domutils

To help you get started, we’ve selected a few domutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jgardella / compat / src / html / features / util.js View on Github external
return attributes.some((attribute) => {
    return domutils.hasAttrib(node, attribute)
  })
}
github Janpot / microdata-node / lib / microdataDom.js View on Github external
function isProperty (element) {
    return DOM.hasAttrib(element, 'itemprop');
  }
github Janpot / microdata-node / lib / microdataDom.js View on Github external
var baseElem = DOM.findOne(function (elem) {
    return elem.name === 'base' && DOM.hasAttrib(elem, 'href');
  }, dom);
  if (baseElem) {
github Janpot / microdata-node / lib / microdataDom.js View on Github external
function getItemValue (element) {
    if (!isProperty(element)) return null;
    if (isItem(element)) return element;
    if (DOM.hasAttrib(element, 'content')) {
      return resolveProperty(DOM.getAttributeValue(element, 'content'));
    }
    if (isName(element, srcProperty)) {
      return resolveUrlProperty(DOM.getAttributeValue(element, 'src'));
    }
    if (isName(element, hrefProperty)) {
      return resolveUrlProperty(DOM.getAttributeValue(element, 'href'));
    }
    if (isName(element, [ 'object' ])) {
      return resolveUrlProperty(DOM.getAttributeValue(element, 'data'));
    }
    if (isName(element, [ 'data', 'meter' ])) {
      return resolveNumberProperty(DOM.getAttributeValue(element, 'value'));
    }
    if (isName(element, [ 'time' ])) {
      return resolveDateProperty(DOM.getAttributeValue(element, 'datetime'));
github Janpot / microdata-node / lib / microdataDom.js View on Github external
function isItem (element) {
    return DOM.hasAttrib(element, 'itemscope');
  }