Comparing version
{ | ||
"name": "vue", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"author": "Evan You <yyx990803@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -56,3 +56,5 @@ var _ = require('../util') | ||
// can have their private assets too. | ||
createAssetRegisters(Sub) | ||
config._assetTypes.forEach(function (type) { | ||
Sub[type] = Super[type] | ||
}) | ||
return Sub | ||
@@ -96,46 +98,24 @@ } | ||
/** | ||
* Define asset registration methods on a constructor. | ||
* Create asset registration methods with the following | ||
* signature: | ||
* | ||
* @param {Function} Constructor | ||
* @param {String} id | ||
* @param {*} definition | ||
*/ | ||
function createAssetRegisters (Constructor) { | ||
/* Asset registration methods share the same signature: | ||
* | ||
* @param {String} id | ||
* @param {*} definition | ||
*/ | ||
config._assetTypes.forEach(function (type) { | ||
Constructor[type] = function (id, definition) { | ||
if (!definition) { | ||
return this.options[type + 's'][id] | ||
} else { | ||
this.options[type + 's'][id] = definition | ||
} | ||
} | ||
}) | ||
/** | ||
* Component registration needs to automatically invoke | ||
* Vue.extend on object values. | ||
* | ||
* @param {String} id | ||
* @param {Object|Function} definition | ||
*/ | ||
Constructor.component = function (id, definition) { | ||
config._assetTypes.forEach(function (type) { | ||
exports[type] = function (id, definition) { | ||
if (!definition) { | ||
return this.options.components[id] | ||
return this.options[type + 's'][id] | ||
} else { | ||
if (_.isPlainObject(definition)) { | ||
if ( | ||
type === 'component' && | ||
_.isPlainObject(definition) | ||
) { | ||
definition.name = id | ||
definition = _.Vue.extend(definition) | ||
} | ||
this.options.components[id] = definition | ||
this.options[type + 's'][id] = definition | ||
} | ||
} | ||
} | ||
createAssetRegisters(exports) | ||
}) |
@@ -19,11 +19,5 @@ var _ = require('../util') | ||
} | ||
el = _.query(el) | ||
if (!el) { | ||
el = document.createElement('div') | ||
} else if (typeof el === 'string') { | ||
var selector = el | ||
el = document.querySelector(el) | ||
if (!el) { | ||
_.warn('Cannot find element: ' + selector) | ||
return | ||
} | ||
} | ||
@@ -74,2 +68,2 @@ this._compile(el) | ||
return compiler.compile(el, this.$options, true, host)(this, el) | ||
} | ||
} |
@@ -564,2 +564,3 @@ var _ = require('../util') | ||
var tag = el.tagName.toLowerCase() | ||
if (_.commonTagRE.test(tag)) return | ||
var def = resolveAsset(options, 'elementDirectives', tag) | ||
@@ -566,0 +567,0 @@ if (def) { |
@@ -74,6 +74,8 @@ module.exports = { | ||
_assetTypes: [ | ||
'component', | ||
'directive', | ||
'elementDirective', | ||
'filter', | ||
'transition' | ||
'transition', | ||
'partial' | ||
], | ||
@@ -80,0 +82,0 @@ |
@@ -30,7 +30,2 @@ var _ = require('../util') | ||
var props = options.props | ||
this._propsUnlinkFn = el && props | ||
? compiler.compileAndLinkProps( | ||
this, el, props | ||
) | ||
: null | ||
if (props && !el) { | ||
@@ -42,2 +37,9 @@ _.warn( | ||
} | ||
// make sure to convert string selectors into element now | ||
el = options.el = _.query(el) | ||
this._propsUnlinkFn = el && props | ||
? compiler.compileAndLinkProps( | ||
this, el, props | ||
) | ||
: null | ||
} | ||
@@ -44,0 +46,0 @@ |
@@ -0,4 +1,23 @@ | ||
var _ = require('./index') | ||
var config = require('../config') | ||
/** | ||
* Query an element selector if it's not an element already. | ||
* | ||
* @param {String|Element} el | ||
* @return {Element} | ||
*/ | ||
exports.query = function (el) { | ||
if (typeof el === 'string') { | ||
var selector = el | ||
el = document.querySelector(el) | ||
if (!el) { | ||
_.warn('Cannot find element: ' + selector) | ||
} | ||
} | ||
return el | ||
} | ||
/** | ||
* Check if a node is in the document. | ||
@@ -5,0 +24,0 @@ * Note: document.documentElement.contains should work here |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
16962
0.02%506385
-0.03%