@ng-doc/core
Advanced tools
Comparing version 17.6.4 to 17.6.5
@@ -22,8 +22,11 @@ "use strict"; | ||
const node = !(0, helpers_1.isPresent)(shiftNode) || !(0, helpers_1.isNodeTag)(shiftNode) ? undefined : shiftNode; | ||
if (tagSelectors.every((tagSelector) => tagSelector.name.toLowerCase() === String(node?.tag).toLowerCase()) && | ||
attrSelectors.every((attrSelector) => { | ||
const attrValue = node && node.attrs && node?.attrs[attrSelector.name]; | ||
return (Object.keys(node?.attrs ?? {}).includes(attrSelector.name) && | ||
attrValue === attrSelector.value); | ||
})) { | ||
const tagSelectorMatch = tagSelectors.every((tagSelector) => tagSelector.name.toLowerCase() === String(node?.tag).toLowerCase()) || !tagSelectors.length; | ||
const attrSelectorsMatch = attrSelectors.every((attrSelector) => { | ||
const nodeAttrs = node?.attrs ?? {}; | ||
const hasAttr = Object.keys(nodeAttrs).includes(attrSelector.name) || | ||
Object.keys(nodeAttrs).includes(`[${attrSelector.name}]`); | ||
const attrValue = nodeAttrs[attrSelector.name] ?? nodeAttrs[`[${attrSelector.name}]`]; | ||
return (hasAttr && !attrSelector.value) || attrValue === attrSelector.value; | ||
}) || !attrSelectors.length; | ||
if (tagSelectorMatch && attrSelectorsMatch) { | ||
return node; | ||
@@ -54,4 +57,7 @@ } | ||
setAttributesFromSelectors(element, selectors) { | ||
const elementAttrs = element.attrs ?? {}; | ||
selectors.forEach((selector) => { | ||
if (selector.type === 'attribute') { | ||
if (selector.type === 'attribute' && | ||
!elementAttrs[selector.name] && | ||
!elementAttrs[`[${selector.name}]`]) { | ||
this.setAttribute(element, selector.name, selector.value); | ||
@@ -58,0 +64,0 @@ } |
{ | ||
"name": "@ng-doc/core", | ||
"version": "17.6.4", | ||
"version": "17.6.5", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
62176
1127