Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getItemType (item) {
var itemType = DOM.getAttributeValue(item, 'itemtype');
var types = (itemType ? splitUnique(itemType) : [])
.filter(isAbsoluteUrl);
return types;
}
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('');
}
walk(dom, function (node) {
var id = DOM.getAttributeValue(node, 'id');
if (id && !idMap[id]) {
idMap[id] = node;
}
});
return idMap;
public getAttribute(name) {
return getAttributeValue(this._dom, name)
}
exports.attributeIs = (node, name, value) => {
return domutils.getAttributeValue(node, name) === value
}
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('');
function getPropertyNames (element) {
var itemProp = DOM.getAttributeValue(element, 'itemprop');
return itemProp ? splitUnique(itemProp) : [];
}
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('');
}
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({});
}