How to use the domutils.getAttributeValue 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 Janpot / microdata-node / lib / microdataDom.js View on Github external
function getItemType (item) {
    var itemType = DOM.getAttributeValue(item, 'itemtype');
    var types = (itemType ? splitUnique(itemType) : [])
      .filter(isAbsoluteUrl);
    return types;
  }
github Janpot / microdata-node / lib / microdataDom.js View on Github external
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'));
    }
    var value = DOM.getText(element);
    if (value || strict) {
      return resolveProperty(value);
    }

    return resolveProperty('');
  }
github Janpot / microdata-node / lib / microdataDom.js View on Github external
walk(dom, function (node) {
    var id = DOM.getAttributeValue(node, 'id');
    if (id && !idMap[id]) {
      idMap[id] = node;
    }
  });
  return idMap;
github superfly / fly / packages / v8env / src / document.ts View on Github external
public getAttribute(name) {
    return getAttributeValue(this._dom, name)
  }
github jgardella / compat / src / html / features / util.js View on Github external
exports.attributeIs = (node, name, value) => {
  return domutils.getAttributeValue(node, name) === value
}
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'));
    }
    var value = DOM.getText(element);
    if (value || strict) {
      return resolveProperty(value);
    }

    return resolveProperty('');
github Janpot / microdata-node / lib / microdataDom.js View on Github external
function getPropertyNames (element) {
    var itemProp = DOM.getAttributeValue(element, 'itemprop');
    return itemProp ? splitUnique(itemProp) : [];
  }
github Janpot / microdata-node / lib / microdataDom.js View on Github external
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'));
    }
    var value = DOM.getText(element);
    if (value || strict) {
      return resolveProperty(value);
    }

    return resolveProperty('');
  }
github broadly / css-inliner / lib / extract_rules.js View on Github external
function extractFromElementAsync(cache, element) {
  if (isStyleElement(element)) {

    DOMUtils.removeElement(element);
    const css           = DOMUtils.getText(element);
    const resultPromise = cache.compileAsync(css);
    return resultPromise;

  } else if (isLocalStylesheet(element)) {

    DOMUtils.removeElement(element);
    const relativeURL   = DOMUtils.getAttributeValue(element, 'href');
    const resultPromise = cache.loadAsync(relativeURL);
    return resultPromise;

  } else
    return Promise.resolve({});
}