|
1 | 1 | /** |
2 | | - * Vue.js v0.12.3 |
| 2 | + * Vue.js v0.12.4 |
3 | 3 | * (c) 2015 Evan You |
4 | 4 | * Released under the MIT License. |
5 | 5 | */ |
@@ -375,10 +375,12 @@ return /******/ (function(modules) { // webpackBootstrap |
375 | 375 | */ |
376 | 376 |
|
377 | 377 | _assetTypes: [ |
| 378 | + 'component', |
378 | 379 | 'directive', |
379 | 380 | 'elementDirective', |
380 | 381 | 'filter', |
381 | | - 'transition' |
| 382 | + 'transition', |
| 383 | + 'partial' |
382 | 384 | ], |
383 | 385 |
|
384 | 386 | /** |
@@ -801,8 +803,27 @@ return /******/ (function(modules) { // webpackBootstrap |
801 | 803 | /* 6 */ |
802 | 804 | /***/ function(module, exports, __webpack_require__) { |
803 | 805 |
|
| 806 | + var _ = __webpack_require__(1) |
804 | 807 | var config = __webpack_require__(3) |
805 | 808 |
|
| 809 | + /** |
| 810 | + * Query an element selector if it's not an element already. |
| 811 | + * |
| 812 | + * @param {String|Element} el |
| 813 | + * @return {Element} |
| 814 | + */ |
| 815 | + |
| 816 | + exports.query = function (el) { |
| 817 | + if (typeof el === 'string') { |
| 818 | + var selector = el |
| 819 | + el = document.querySelector(el) |
| 820 | + if (!el) { |
| 821 | + _.warn('Cannot find element: ' + selector) |
| 822 | + } |
| 823 | + } |
| 824 | + return el |
| 825 | + } |
| 826 | + |
806 | 827 | /** |
807 | 828 | * Check if a node is in the document. |
808 | 829 | * Note: document.documentElement.contains should work here |
@@ -1447,7 +1468,9 @@ return /******/ (function(modules) { // webpackBootstrap |
1447 | 1468 | Sub.extend = Super.extend |
1448 | 1469 | // create asset registers, so extended classes |
1449 | 1470 | // can have their private assets too. |
1450 | | - createAssetRegisters(Sub) |
| 1471 | + config._assetTypes.forEach(function (type) { |
| 1472 | + Sub[type] = Super[type] |
| 1473 | + }) |
1451 | 1474 | return Sub |
1452 | 1475 | } |
1453 | 1476 |
|
@@ -1486,51 +1509,29 @@ return /******/ (function(modules) { // webpackBootstrap |
1486 | 1509 | } |
1487 | 1510 |
|
1488 | 1511 | /** |
1489 | | - * Define asset registration methods on a constructor. |
| 1512 | + * Create asset registration methods with the following |
| 1513 | + * signature: |
1490 | 1514 | * |
1491 | | - * @param {Function} Constructor |
| 1515 | + * @param {String} id |
| 1516 | + * @param {*} definition |
1492 | 1517 | */ |
1493 | 1518 |
|
1494 | | - function createAssetRegisters (Constructor) { |
1495 | | - |
1496 | | - /* Asset registration methods share the same signature: |
1497 | | - * |
1498 | | - * @param {String} id |
1499 | | - * @param {*} definition |
1500 | | - */ |
1501 | | - |
1502 | | - config._assetTypes.forEach(function (type) { |
1503 | | - Constructor[type] = function (id, definition) { |
1504 | | - if (!definition) { |
1505 | | - return this.options[type + 's'][id] |
1506 | | - } else { |
1507 | | - this.options[type + 's'][id] = definition |
1508 | | - } |
1509 | | - } |
1510 | | - }) |
1511 | | - |
1512 | | - /** |
1513 | | - * Component registration needs to automatically invoke |
1514 | | - * Vue.extend on object values. |
1515 | | - * |
1516 | | - * @param {String} id |
1517 | | - * @param {Object|Function} definition |
1518 | | - */ |
1519 | | - |
1520 | | - Constructor.component = function (id, definition) { |
| 1519 | + config._assetTypes.forEach(function (type) { |
| 1520 | + exports[type] = function (id, definition) { |
1521 | 1521 | if (!definition) { |
1522 | | - return this.options.components[id] |
| 1522 | + return this.options[type + 's'][id] |
1523 | 1523 | } else { |
1524 | | - if (_.isPlainObject(definition)) { |
| 1524 | + if ( |
| 1525 | + type === 'component' && |
| 1526 | + _.isPlainObject(definition) |
| 1527 | + ) { |
1525 | 1528 | definition.name = id |
1526 | 1529 | definition = _.Vue.extend(definition) |
1527 | 1530 | } |
1528 | | - this.options.components[id] = definition |
| 1531 | + this.options[type + 's'][id] = definition |
1529 | 1532 | } |
1530 | 1533 | } |
1531 | | - } |
1532 | | - |
1533 | | - createAssetRegisters(exports) |
| 1534 | + }) |
1534 | 1535 |
|
1535 | 1536 |
|
1536 | 1537 | /***/ }, |
@@ -2109,6 +2110,7 @@ return /******/ (function(modules) { // webpackBootstrap |
2109 | 2110 |
|
2110 | 2111 | function checkElementDirectives (el, options) { |
2111 | 2112 | var tag = el.tagName.toLowerCase() |
| 2113 | + if (_.commonTagRE.test(tag)) return |
2112 | 2114 | var def = resolveAsset(options, 'elementDirectives', tag) |
2113 | 2115 | if (def) { |
2114 | 2116 | return makeTerminalNodeLinkFn(el, tag, '', options, def) |
@@ -8105,17 +8107,19 @@ return /******/ (function(modules) { // webpackBootstrap |
8105 | 8107 | var options = this.$options |
8106 | 8108 | var el = options.el |
8107 | 8109 | var props = options.props |
8108 | | - this._propsUnlinkFn = el && props |
8109 | | - ? compiler.compileAndLinkProps( |
8110 | | - this, el, props |
8111 | | - ) |
8112 | | - : null |
8113 | 8110 | if (props && !el) { |
8114 | 8111 | _.warn( |
8115 | 8112 | 'Props will not be compiled if no `el` option is ' + |
8116 | 8113 | 'provided at instantiation.' |
8117 | 8114 | ) |
8118 | 8115 | } |
| 8116 | + // make sure to convert string selectors into element now |
| 8117 | + el = options.el = _.query(el) |
| 8118 | + this._propsUnlinkFn = el && props |
| 8119 | + ? compiler.compileAndLinkProps( |
| 8120 | + this, el, props |
| 8121 | + ) |
| 8122 | + : null |
8119 | 8123 | } |
8120 | 8124 |
|
8121 | 8125 | /** |
@@ -9500,15 +9504,9 @@ return /******/ (function(modules) { // webpackBootstrap |
9500 | 9504 | _.warn('$mount() should be called only once.') |
9501 | 9505 | return |
9502 | 9506 | } |
| 9507 | + el = _.query(el) |
9503 | 9508 | if (!el) { |
9504 | 9509 | el = document.createElement('div') |
9505 | | - } else if (typeof el === 'string') { |
9506 | | - var selector = el |
9507 | | - el = document.querySelector(el) |
9508 | | - if (!el) { |
9509 | | - _.warn('Cannot find element: ' + selector) |
9510 | | - return |
9511 | | - } |
9512 | 9510 | } |
9513 | 9511 | this._compile(el) |
9514 | 9512 | this._isCompiled = true |
@@ -9556,6 +9554,7 @@ return /******/ (function(modules) { // webpackBootstrap |
9556 | 9554 | return compiler.compile(el, this.$options, true, host)(this, el) |
9557 | 9555 | } |
9558 | 9556 |
|
| 9557 | + |
9559 | 9558 | /***/ } |
9560 | 9559 | /******/ ]) |
9561 | 9560 | }); |
|
0 commit comments