* Check if an element is a component, if yes return its * component id. * * @param {Element} el * @param {Object} options * @return {Object|undefined}
(el, options)
| 1577 | */ |
| 1578 | |
| 1579 | function checkComponentAttr(el, options) { |
| 1580 | var tag = el.tagName.toLowerCase(); |
| 1581 | var hasAttrs = el.hasAttributes(); |
| 1582 | if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) { |
| 1583 | if (resolveAsset(options, 'components', tag)) { |
| 1584 | return { id: tag }; |
| 1585 | } else { |
| 1586 | var is = hasAttrs && getIsBinding(el, options); |
| 1587 | if (is) { |
| 1588 | return is; |
| 1589 | } else if ('development' !== 'production') { |
| 1590 | var expectedTag = options._componentNameMap && options._componentNameMap[tag]; |
| 1591 | if (expectedTag) { |
| 1592 | warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.'); |
| 1593 | } else if (isUnknownElement(el, tag)) { |
| 1594 | warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.'); |
| 1595 | } |
| 1596 | } |
| 1597 | } |
| 1598 | } else if (hasAttrs) { |
| 1599 | return getIsBinding(el, options); |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | /** |
| 1604 | * Get "is" binding from an element. |
no test coverage detected