MCPcopy
hub / github.com/keepfool/vue-tutorials / checkComponentAttr

Function checkComponentAttr

06.Router/basic/js/vue.js:1579–1601  ·  view source on GitHub ↗

* Check if an element is a component, if yes return its * component id. * * @param {Element} el * @param {Object} options * @return {Object|undefined}

(el, options)

Source from the content-addressed store, hash-verified

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.

Callers 1

checkComponentFunction · 0.70

Calls 3

resolveAssetFunction · 0.70
getIsBindingFunction · 0.70
warnFunction · 0.70

Tested by

no test coverage detected