* Extract a map of properties to values for a given element or template node, which can be used * by the directive matching machinery. * * @param elOrTpl the element or template in question * @return an object set up for directive matching. For attributes on the element/template, this * object
(elOrTpl: t.Element | t.Template)
| 205 | * property name to an empty string. |
| 206 | */ |
| 207 | function getAttrsForDirectiveMatching(elOrTpl: t.Element | t.Template): {[name: string]: string} { |
| 208 | const attributesMap: {[name: string]: string} = {}; |
| 209 | |
| 210 | if (elOrTpl instanceof t.Template && elOrTpl.tagName !== 'ng-template') { |
| 211 | elOrTpl.templateAttrs.forEach((a) => (attributesMap[a.name] = '')); |
| 212 | } else { |
| 213 | elOrTpl.attributes.forEach((a) => { |
| 214 | if (!isI18nAttribute(a.name)) { |
| 215 | attributesMap[a.name] = a.value; |
| 216 | } |
| 217 | }); |
| 218 | |
| 219 | elOrTpl.inputs.forEach((i) => { |
| 220 | if (i.type === BindingType.Property || i.type === BindingType.TwoWay) { |
| 221 | attributesMap[i.name] = ''; |
| 222 | } |
| 223 | }); |
| 224 | elOrTpl.outputs.forEach((o) => { |
| 225 | attributesMap[o.name] = ''; |
| 226 | }); |
| 227 | } |
| 228 | |
| 229 | return attributesMap; |
| 230 | } |
no test coverage detected
searching dependent graphs…