Comparing version 0.12.4 to 0.12.5
{ | ||
"name": "vue", | ||
"version": "0.12.4", | ||
"version": "0.12.5", | ||
"author": "Evan You <yyx990803@gmail.com>", | ||
@@ -27,6 +27,5 @@ "license": "MIT", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-eslint": "^16.0.0", | ||
"grunt-karma": "^0.8.3", | ||
"jasmine-core": "^2.3.4", | ||
"jshint-stylish": "^0.3.0", | ||
"karma": "^0.12.31", | ||
@@ -33,0 +32,0 @@ "karma-chrome-launcher": "^0.1.7", |
@@ -47,2 +47,2 @@ var _ = require('../util') | ||
return child | ||
} | ||
} |
@@ -124,3 +124,3 @@ var _ = require('../util') | ||
if (!this._eventsCount[event]) return | ||
var children = this._children | ||
var children = this.$children | ||
for (var i = 0, l = children.length; i < l; i++) { | ||
@@ -175,2 +175,2 @@ var child = children[i] | ||
} | ||
} | ||
} |
@@ -36,4 +36,4 @@ /** | ||
var entry = { | ||
key:key, | ||
value:value | ||
key: key, | ||
value: value | ||
} | ||
@@ -113,2 +113,2 @@ this._keymap[key] = entry | ||
module.exports = Cache | ||
module.exports = Cache |
@@ -68,3 +68,2 @@ var _ = require('../util') | ||
}, vm) | ||
// | ||
return makeUnlinkFn(vm, dirs) | ||
@@ -92,3 +91,3 @@ } | ||
* the process. | ||
* | ||
* | ||
* We create unlink functions with only the necessary | ||
@@ -99,12 +98,12 @@ * information to avoid retaining additional closures. | ||
* @param {Array} dirs | ||
* @param {Vue} [parent] | ||
* @param {Array} [parentDirs] | ||
* @param {Vue} [context] | ||
* @param {Array} [contextDirs] | ||
* @return {Function} | ||
*/ | ||
function makeUnlinkFn (vm, dirs, parent, parentDirs) { | ||
function makeUnlinkFn (vm, dirs, context, contextDirs) { | ||
return function unlink (destroying) { | ||
teardownDirs(vm, dirs, destroying) | ||
if (parent && parentDirs) { | ||
teardownDirs(parent, parentDirs) | ||
if (context && contextDirs) { | ||
teardownDirs(context, contextDirs) | ||
} | ||
@@ -152,3 +151,3 @@ } | ||
* | ||
* 1. attrs on parent container (parent scope) | ||
* 1. attrs on context container (context scope) | ||
* 2. attrs on the component template root node, if | ||
@@ -161,3 +160,3 @@ * replace:true (child scope) | ||
* since root linkers can not be reused. It returns the | ||
* unlink function for potential parent directives on the | ||
* unlink function for potential context directives on the | ||
* container. | ||
@@ -171,6 +170,6 @@ * | ||
exports.compileAndLinkRoot = function (vm, el, options) { | ||
exports.compileAndLinkRoot = function (vm, el, options) { | ||
var containerAttrs = options._containerAttrs | ||
var replacerAttrs = options._replacerAttrs | ||
var parentLinkFn, replacerLinkFn | ||
var contextLinkFn, replacerLinkFn | ||
@@ -185,3 +184,3 @@ // only need to compile other attributes for | ||
if (containerAttrs) { | ||
parentLinkFn = compileDirectives(containerAttrs, options) | ||
contextLinkFn = compileDirectives(containerAttrs, options) | ||
} | ||
@@ -198,9 +197,9 @@ if (replacerAttrs) { | ||
// link parent dirs | ||
var parent = vm.$parent | ||
var parentDirs | ||
if (parent && parentLinkFn) { | ||
parentDirs = linkAndCapture(function () { | ||
parentLinkFn(parent, el) | ||
}, parent) | ||
// link context scope dirs | ||
var context = vm._context | ||
var contextDirs | ||
if (context && contextLinkFn) { | ||
contextDirs = linkAndCapture(function () { | ||
contextLinkFn(context, el) | ||
}, context) | ||
} | ||
@@ -213,5 +212,5 @@ | ||
// return the unlink function that tearsdown parent | ||
// return the unlink function that tearsdown context | ||
// container directives. | ||
return makeUnlinkFn(vm, selfDirs, parent, parentDirs) | ||
return makeUnlinkFn(vm, selfDirs, context, contextDirs) | ||
} | ||
@@ -248,9 +247,12 @@ | ||
function compileElement (el, options) { | ||
var linkFn | ||
var hasAttrs = el.hasAttributes() | ||
// check element directives | ||
var linkFn = checkElementDirectives(el, options) | ||
// check terminal directives (repeat & if) | ||
if (!linkFn && hasAttrs) { | ||
if (hasAttrs) { | ||
linkFn = checkTerminalDirectives(el, options) | ||
} | ||
// check element directives | ||
if (!linkFn) { | ||
linkFn = checkElementDirectives(el, options) | ||
} | ||
// check component | ||
@@ -426,3 +428,3 @@ if (!linkFn) { | ||
* @param {Element|DocumentFragment} el | ||
* @param {Array} propDescriptors | ||
* @param {Array} propOptions | ||
* @return {Function} propsLinkFn | ||
@@ -436,16 +438,9 @@ */ | ||
function compileProps (el, propDescriptors) { | ||
function compileProps (el, propOptions) { | ||
var props = [] | ||
var i = propDescriptors.length | ||
var descriptor, name, assertions, value, path, prop, literal, single | ||
var i = propOptions.length | ||
var options, name, value, path, prop, literal, single | ||
while (i--) { | ||
descriptor = propDescriptors[i] | ||
// normalize prop string/descriptor | ||
if (typeof descriptor === 'object') { | ||
name = descriptor.name | ||
assertions = descriptor | ||
} else { | ||
name = descriptor | ||
assertions = null | ||
} | ||
options = propOptions[i] | ||
name = options.name | ||
// props could contain dashes, which will be | ||
@@ -476,3 +471,3 @@ // interpreted as minus calculations by the parser | ||
path: path, | ||
assertions: assertions, | ||
options: options, | ||
mode: propBindingModes.ONE_WAY | ||
@@ -511,3 +506,3 @@ } | ||
} | ||
} else if (assertions && assertions.required) { | ||
} else if (options && options.required) { | ||
_.warn('Missing required prop: ' + name) | ||
@@ -530,15 +525,20 @@ } | ||
var i = props.length | ||
var prop, path, value | ||
var prop, path, options, value | ||
while (i--) { | ||
prop = props[i] | ||
path = prop.path | ||
options = prop.options | ||
if (prop.raw === null) { | ||
// initialize undefined prop | ||
vm._data[path] = undefined | ||
// initialize absent prop | ||
vm._data[path] = options.type === Boolean | ||
? false | ||
: options.hasOwnProperty('default') | ||
? options.default | ||
: undefined | ||
} else if (prop.dynamic) { | ||
// dynamic prop | ||
if (vm.$parent) { | ||
if (vm._context) { | ||
if (prop.mode === propBindingModes.ONE_TIME) { | ||
// one time binding | ||
value = vm.$parent.$get(prop.parentPath) | ||
value = vm._context.$get(prop.parentPath) | ||
if (_.assertProp(prop, value)) { | ||
@@ -560,3 +560,5 @@ vm[path] = vm._data[path] = value | ||
// literal, cast it and just set once | ||
value = _.toBoolean(_.toNumber(prop.raw)) | ||
value = options.type === Boolean && prop.raw === '' | ||
? true | ||
: _.toBoolean(_.toNumber(prop.raw)) | ||
if (_.assertProp(prop, value)) { | ||
@@ -624,3 +626,2 @@ vm[path] = vm._data[path] = value | ||
var value, dirName | ||
/* jshint boss: true */ | ||
for (var i = 0, l = terminalDirectives.length; i < l; i++) { | ||
@@ -627,0 +628,0 @@ dirName = terminalDirectives[i] |
var _ = require('../util') | ||
_.extend(exports, require('./compile')) | ||
_.extend(exports, require('./transclude')) | ||
_.extend(exports, require('./transclude')) |
@@ -73,7 +73,8 @@ var _ = require('../util') | ||
replacer.nodeType !== 1 || | ||
// when root node is <content>, <partial> or has | ||
// v-repeat, the instance could end up having | ||
// multiple top-level nodes, thus becoming a block | ||
// instance. | ||
tag === 'content' || tag === 'partial' || | ||
// when root node is <component>, is an element | ||
// directive, or has v-repeat, the instance could | ||
// end up having multiple top-level nodes, thus | ||
// becoming a block instance. | ||
tag === 'component' || | ||
_.resolveAsset(options, 'elementDirectives', tag) || | ||
replacer.hasAttribute(config.prefix + 'repeat') | ||
@@ -80,0 +81,0 @@ ) { |
@@ -220,2 +220,2 @@ var _ = require('./util') | ||
module.exports = Directive | ||
module.exports = Directive |
@@ -6,3 +6,3 @@ var _ = require('../util') | ||
module.exports = { | ||
update: function (value) { | ||
@@ -46,2 +46,2 @@ if (this.arg) { | ||
} | ||
} | ||
} |
var config = require('../config') | ||
module.exports = { | ||
bind: function () { | ||
@@ -11,3 +10,2 @@ var el = this.el | ||
} | ||
} | ||
} |
@@ -169,6 +169,6 @@ var _ = require('../util') | ||
} | ||
var vm = this.vm | ||
var el = templateParser.clone(this.el) | ||
if (this.Ctor) { | ||
var child = vm.$addChild({ | ||
var parent = this._host || this.vm | ||
var el = templateParser.clone(this.el) | ||
var child = parent.$addChild({ | ||
el: el, | ||
@@ -181,4 +181,4 @@ data: data, | ||
_asComponent: true, | ||
_host: this._host, | ||
_isRouterView: this._isRouterView | ||
_isRouterView: this._isRouterView, | ||
_context: this.vm | ||
}, this.Ctor) | ||
@@ -262,3 +262,3 @@ if (this.keepAlive) { | ||
*/ | ||
setCurrent: function (child) { | ||
@@ -292,2 +292,3 @@ this.childVM = child | ||
this.unbuild() | ||
this.unsetCurrent() | ||
// destroy all keep-alive cached instances | ||
@@ -294,0 +295,0 @@ if (this.cache) { |
@@ -12,3 +12,2 @@ module.exports = { | ||
} | ||
} | ||
} |
@@ -40,3 +40,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -81,8 +81,2 @@ var _ = require('../util') | ||
var end = this.end | ||
var selfCompoents = | ||
vm._children.length && | ||
vm._children.filter(contains) | ||
var transComponents = | ||
vm._transCpnts && | ||
vm._transCpnts.filter(contains) | ||
@@ -105,7 +99,4 @@ function contains (c) { | ||
return selfCompoents | ||
? transComponents | ||
? selfCompoents.concat(transComponents) | ||
: selfCompoents | ||
: transComponents | ||
return vm.$children.length && | ||
vm.$children.filter(contains) | ||
}, | ||
@@ -112,0 +103,0 @@ |
// manipulation directives | ||
exports.text = require('./text') | ||
exports.html = require('./html') | ||
exports.attr = require('./attr') | ||
exports.show = require('./show') | ||
exports['class'] = require('./class') | ||
exports.el = require('./el') | ||
exports.ref = require('./ref') | ||
exports.cloak = require('./cloak') | ||
exports.style = require('./style') | ||
exports.text = require('./text') | ||
exports.html = require('./html') | ||
exports.attr = require('./attr') | ||
exports.show = require('./show') | ||
exports['class'] = require('./class') | ||
exports.el = require('./el') | ||
exports.ref = require('./ref') | ||
exports.cloak = require('./cloak') | ||
exports.style = require('./style') | ||
exports.transition = require('./transition') | ||
// event listener directives | ||
exports.on = require('./on') | ||
exports.model = require('./model') | ||
exports.on = require('./on') | ||
exports.model = require('./model') | ||
// logic control directives | ||
exports.repeat = require('./repeat') | ||
exports['if'] = require('./if') | ||
exports.repeat = require('./repeat') | ||
exports['if'] = require('./if') | ||
@@ -24,2 +24,2 @@ // internal directives that should not be used directly | ||
exports._component = require('./component') | ||
exports._prop = require('./prop') | ||
exports._prop = require('./prop') |
@@ -24,3 +24,2 @@ var _ = require('../../util') | ||
} | ||
} | ||
} |
@@ -74,3 +74,2 @@ var _ = require('../../util') | ||
} | ||
} | ||
} |
@@ -18,4 +18,5 @@ var _ = require('../../util') | ||
update: function (value) { | ||
/* jshint eqeqeq: false */ | ||
/* eslint-disable eqeqeq */ | ||
this.el.checked = value == this.el.value | ||
/* eslint-enable eqeqeq */ | ||
}, | ||
@@ -26,3 +27,2 @@ | ||
} | ||
} | ||
} |
@@ -33,3 +33,2 @@ var _ = require('../../util') | ||
update: function (value) { | ||
/* jshint eqeqeq: false */ | ||
var el = this.el | ||
@@ -43,5 +42,7 @@ el.selectedIndex = -1 | ||
option = options[i] | ||
/* eslint-disable eqeqeq */ | ||
option.selected = multi | ||
? indexOf(value, option.value) > -1 | ||
: value == option.value | ||
/* eslint-enable eqeqeq */ | ||
} | ||
@@ -110,3 +111,2 @@ }, | ||
} else { | ||
/* jshint eqeqeq: false */ | ||
if (op.value != null) { | ||
@@ -183,8 +183,9 @@ el.value = op.value | ||
function indexOf (arr, val) { | ||
/* jshint eqeqeq: false */ | ||
var i = arr.length | ||
while (i--) { | ||
/* eslint-disable eqeqeq */ | ||
if (arr[i] == val) return i | ||
/* eslint-enable eqeqeq */ | ||
} | ||
return -1 | ||
} | ||
} |
@@ -36,4 +36,4 @@ var _ = require('../../util') | ||
} | ||
_.on(el,'compositionstart', this.onComposeStart) | ||
_.on(el,'compositionend', this.onComposeEnd) | ||
_.on(el, 'compositionstart', this.onComposeStart) | ||
_.on(el, 'compositionend', this.onComposeEnd) | ||
} | ||
@@ -101,3 +101,3 @@ | ||
// rely on $.trigger() | ||
// | ||
// | ||
// We want to make sure if a listener is attached using | ||
@@ -157,6 +157,6 @@ // jQuery, it is also removed with jQuery, that's why | ||
if (this.onCut) { | ||
_.off(el,'cut', this.onCut) | ||
_.off(el,'keyup', this.onDel) | ||
_.off(el, 'cut', this.onCut) | ||
_.off(el, 'keyup', this.onDel) | ||
} | ||
} | ||
} | ||
} |
@@ -59,2 +59,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -15,3 +15,3 @@ // NOTE: the prop internal directive is compiled and linked | ||
var child = this.vm | ||
var parent = child.$parent | ||
var parent = child._context | ||
// passed in from compiler directly | ||
@@ -18,0 +18,0 @@ var prop = this._descriptor |
@@ -22,3 +22,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -349,3 +349,4 @@ var _ = require('../util') | ||
var Ctor = this.Ctor || this.resolveDynamicComponent(data, meta) | ||
var vm = this.vm.$addChild({ | ||
var parent = this._host || this.vm | ||
var vm = parent.$addChild({ | ||
el: templateParser.clone(this.template), | ||
@@ -363,8 +364,8 @@ data: data, | ||
_linkerCachable: !this.inlineTemplate && Ctor !== _.Vue, | ||
// transclusion host | ||
_host: this._host, | ||
// pre-compiled linker for simple repeats | ||
_linkFn: this._linkFn, | ||
// identifier, shows that this vm belongs to this collection | ||
_repeatId: this.id | ||
_repeatId: this.id, | ||
// transclusion content owner | ||
_context: this.vm | ||
}, Ctor) | ||
@@ -371,0 +372,0 @@ // cache instance |
@@ -8,2 +8,2 @@ var transition = require('../transition') | ||
}, this.vm) | ||
} | ||
} |
@@ -110,2 +110,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -14,3 +14,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -26,3 +26,2 @@ var _ = require('../util') | ||
} | ||
} | ||
} |
@@ -12,9 +12,9 @@ var _ = require('../util') | ||
var vm = this.vm | ||
var contentOwner = vm | ||
// we need find the content owner, which is the closest | ||
// non-inline-repeater instance. | ||
while (contentOwner.$options._repeat) { | ||
contentOwner = contentOwner.$parent | ||
var host = vm | ||
// we need find the content context, which is the | ||
// closest non-inline-repeater instance. | ||
while (host.$options._repeat) { | ||
host = host.$parent | ||
} | ||
var raw = contentOwner.$options._content | ||
var raw = host.$options._content | ||
var content | ||
@@ -25,3 +25,3 @@ if (!raw) { | ||
} | ||
var parent = contentOwner.$parent | ||
var context = host._context | ||
var selector = this.el.getAttribute('select') | ||
@@ -34,7 +34,7 @@ if (!selector) { | ||
extractFragment(raw.childNodes, raw, true), | ||
contentOwner.$parent, | ||
context, | ||
vm | ||
) | ||
} | ||
if (!contentOwner._isCompiled) { | ||
if (!host._isCompiled) { | ||
// defer until the end of instance compilation, | ||
@@ -44,3 +44,3 @@ // because the default outlet must wait until all | ||
// out their contents. | ||
contentOwner.$once('hook:compiled', compileDefaultContent) | ||
host.$once('hook:compiled', compileDefaultContent) | ||
} else { | ||
@@ -56,3 +56,3 @@ compileDefaultContent() | ||
if (content.hasChildNodes()) { | ||
this.compile(content, parent, vm) | ||
this.compile(content, context, vm) | ||
} else { | ||
@@ -71,5 +71,5 @@ this.fallback() | ||
compile: function (content, owner, host) { | ||
if (content && owner) { | ||
this.unlink = owner.$compile(content, host) | ||
compile: function (content, context, host) { | ||
if (content && context) { | ||
this.unlink = context.$compile(content, host) | ||
} | ||
@@ -86,3 +86,3 @@ if (content) { | ||
this.unlink() | ||
} | ||
} | ||
} | ||
@@ -89,0 +89,0 @@ } |
@@ -47,3 +47,3 @@ var _ = require('../util') | ||
insert: function (id) { | ||
var partial = this.vm.$options.partials[id] | ||
var partial = _.resolveAsset(this.vm.$options, 'partials', id) | ||
_.assertAsset(partial, 'partial', id) | ||
@@ -50,0 +50,0 @@ if (partial) { |
@@ -18,3 +18,2 @@ var _ = require('../util') | ||
} | ||
/* jshint eqeqeq: false */ | ||
if (search == null) { | ||
@@ -21,0 +20,0 @@ return arr |
@@ -107,10 +107,10 @@ var _ = require('../util') | ||
var keyCodes = { | ||
enter : 13, | ||
tab : 9, | ||
'delete' : 46, | ||
up : 38, | ||
left : 37, | ||
right : 39, | ||
down : 40, | ||
esc : 27 | ||
esc: 27, | ||
tab: 9, | ||
enter: 13, | ||
'delete': 46, | ||
up: 38, | ||
left: 37, | ||
right: 39, | ||
down: 40 | ||
} | ||
@@ -117,0 +117,0 @@ |
@@ -130,13 +130,8 @@ var _ = require('../util') | ||
if (parent && !parent._isBeingDestroyed) { | ||
parent._children.$remove(this) | ||
parent.$children.$remove(this) | ||
} | ||
// same for transclusion host. | ||
var host = this._host | ||
if (host && !host._isBeingDestroyed) { | ||
host._transCpnts.$remove(this) | ||
} | ||
// destroy all children. | ||
i = this._children.length | ||
i = this.$children.length | ||
while (i--) { | ||
this._children[i].$destroy() | ||
this.$children[i].$destroy() | ||
} | ||
@@ -185,4 +180,3 @@ // teardown props | ||
this.$root = | ||
this._children = | ||
this._transCpnts = | ||
this.$children = | ||
this._directives = null | ||
@@ -189,0 +183,0 @@ // call the last hook... |
@@ -45,9 +45,10 @@ var _ = require('../util') | ||
* @param {String} key | ||
* @param {*} handler | ||
* @param {Function|String|Object} handler | ||
* @param {Object} [options] | ||
*/ | ||
function register (vm, action, key, handler) { | ||
function register (vm, action, key, handler, options) { | ||
var type = typeof handler | ||
if (type === 'function') { | ||
vm[action](key, handler) | ||
vm[action](key, handler, options) | ||
} else if (type === 'string') { | ||
@@ -57,3 +58,3 @@ var methods = vm.$options.methods | ||
if (method) { | ||
vm[action](key, method) | ||
vm[action](key, method, options) | ||
} else { | ||
@@ -66,2 +67,4 @@ _.warn( | ||
} | ||
} else if (handler && type === 'object') { | ||
register(vm, action, key, handler.handler, handler) | ||
} | ||
@@ -85,6 +88,3 @@ } | ||
this._isAttached = true | ||
this._children.forEach(callAttach) | ||
if (this._transCpnts.length) { | ||
this._transCpnts.forEach(callAttach) | ||
} | ||
this.$children.forEach(callAttach) | ||
} | ||
@@ -94,3 +94,3 @@ | ||
* Iterator to call attached hook | ||
* | ||
* | ||
* @param {Vue} child | ||
@@ -111,6 +111,3 @@ */ | ||
this._isAttached = false | ||
this._children.forEach(callDetach) | ||
if (this._transCpnts.length) { | ||
this._transCpnts.forEach(callDetach) | ||
} | ||
this.$children.forEach(callDetach) | ||
} | ||
@@ -120,3 +117,3 @@ | ||
* Iterator to call detached hook | ||
* | ||
* | ||
* @param {Vue} child | ||
@@ -145,2 +142,2 @@ */ | ||
this.$emit('hook:' + hook) | ||
} | ||
} |
@@ -18,9 +18,11 @@ var mergeOptions = require('../util').mergeOptions | ||
this.$el = null | ||
this.$parent = options._parent | ||
this.$root = options._root || this | ||
this.$ = {} // child vm references | ||
this.$$ = {} // element references | ||
this._watchers = [] // all watchers as an array | ||
this._directives = [] // all directives | ||
this.$el = null | ||
this.$parent = options._parent | ||
this.$root = options._root || this | ||
this.$children = [] | ||
this.$ = {} // child vm references | ||
this.$$ = {} // element references | ||
this._watchers = [] // all watchers as an array | ||
this._directives = [] // all directives | ||
this._childCtors = {} // inherit:true constructors | ||
@@ -31,36 +33,30 @@ // a flag to avoid this being observed | ||
// events bookkeeping | ||
this._events = {} // registered callbacks | ||
this._eventsCount = {} // for $broadcast optimization | ||
this._events = {} // registered callbacks | ||
this._eventsCount = {} // for $broadcast optimization | ||
this._eventCancelled = false // for event cancellation | ||
// block instance properties | ||
this._isBlock = false | ||
this._blockStart = // @type {CommentNode} | ||
this._blockEnd = null // @type {CommentNode} | ||
this._isBlock = false | ||
this._blockStart = // @type {CommentNode} | ||
this._blockEnd = null // @type {CommentNode} | ||
// lifecycle state | ||
this._isCompiled = | ||
this._isCompiled = | ||
this._isDestroyed = | ||
this._isReady = | ||
this._isAttached = | ||
this._isReady = | ||
this._isAttached = | ||
this._isBeingDestroyed = false | ||
this._unlinkFn = null | ||
this._unlinkFn = null | ||
// children | ||
this._children = [] | ||
this._childCtors = {} | ||
// context: the scope in which the component was used, | ||
// and the scope in which props and contents of this | ||
// instance should be compiled in. | ||
this._context = | ||
options._context || | ||
options._parent | ||
// transcluded components that belong to the parent. | ||
// need to keep track of them so that we can call | ||
// attached/detached hooks on them. | ||
this._transCpnts = [] | ||
this._host = options._host | ||
// push self into parent / transclusion host | ||
if (this.$parent) { | ||
this.$parent._children.push(this) | ||
this.$parent.$children.push(this) | ||
} | ||
if (this._host) { | ||
this._host._transCpnts.push(this) | ||
} | ||
@@ -67,0 +63,0 @@ // props used in v-repeat diffing |
@@ -46,3 +46,3 @@ var _ = require('../util') | ||
/** | ||
* Initialize the data. | ||
* Initialize the data. | ||
*/ | ||
@@ -61,3 +61,3 @@ | ||
) { | ||
optionsData[prop] = propsData[prop] | ||
optionsData.$set(prop, propsData[prop]) | ||
} | ||
@@ -99,3 +99,3 @@ } | ||
while (i--) { | ||
key = props[i] | ||
key = props[i].name | ||
if (key !== '$data' && !newData.hasOwnProperty(key)) { | ||
@@ -174,3 +174,3 @@ newData.$set(key, oldData[key]) | ||
} | ||
var children = this._children | ||
var children = this.$children | ||
i = children.length | ||
@@ -177,0 +177,0 @@ while (i--) { |
@@ -87,3 +87,3 @@ var _ = require('../util') | ||
if (index > -1) { | ||
this.splice(index, 1) | ||
return this.splice(index, 1) | ||
} | ||
@@ -93,2 +93,2 @@ } | ||
module.exports = arrayMethods | ||
module.exports = arrayMethods |
@@ -14,3 +14,3 @@ var _ = require('../util') | ||
var ARRAY = 0 | ||
var ARRAY = 0 | ||
var OBJECT = 1 | ||
@@ -17,0 +17,0 @@ |
@@ -82,2 +82,2 @@ var _ = require('../util') | ||
} | ||
) | ||
) |
@@ -179,2 +179,2 @@ var _ = require('../util') | ||
return dirs | ||
} | ||
} |
@@ -110,4 +110,3 @@ var _ = require('../util') | ||
_.warn( | ||
'Avoid using reserved keywords in expression: ' | ||
+ exp | ||
'Avoid using reserved keywords in expression: ' + exp | ||
) | ||
@@ -264,2 +263,2 @@ } | ||
exp.slice(0, 5) !== 'Math.' | ||
} | ||
} |
@@ -47,3 +47,3 @@ var _ = require('../util') | ||
'"': ['inDoubleQuote', 'append', ''], | ||
"ident": ['inIdent', 'append', '*'] | ||
'ident': ['inIdent', 'append', '*'] | ||
}, | ||
@@ -97,3 +97,3 @@ | ||
switch(code) { | ||
switch (code) { | ||
case 0x5B: // [ | ||
@@ -123,4 +123,6 @@ case 0x5D: // ] | ||
// a-z, A-Z | ||
if ((0x61 <= code && code <= 0x7A) || | ||
(0x41 <= code && code <= 0x5A)) { | ||
if ( | ||
(code >= 0x61 && code <= 0x7A) || | ||
(code >= 0x41 && code <= 0x5A) | ||
) { | ||
return 'ident' | ||
@@ -130,3 +132,3 @@ } | ||
// 1-9 | ||
if (0x31 <= code && code <= 0x39) { | ||
if (code >= 0x31 && code <= 0x39) { | ||
return 'number' | ||
@@ -153,3 +155,3 @@ } | ||
var actions = { | ||
push: function() { | ||
push: function () { | ||
if (key === undefined) { | ||
@@ -161,3 +163,3 @@ return | ||
}, | ||
append: function() { | ||
append: function () { | ||
if (key === undefined) { | ||
@@ -164,0 +166,0 @@ key = newChar |
@@ -7,6 +7,6 @@ var _ = require('../util') | ||
var map = { | ||
_default : [0, '', ''], | ||
legend : [1, '<fieldset>', '</fieldset>'], | ||
tr : [2, '<table><tbody>', '</tbody></table>'], | ||
col : [ | ||
_default: [0, '', ''], | ||
legend: [1, '<fieldset>', '</fieldset>'], | ||
tr: [2, '<table><tbody>', '</tbody></table>'], | ||
col: [ | ||
2, | ||
@@ -90,8 +90,8 @@ '<table><tbody></tbody><colgroup>', | ||
var tag = tagMatch && tagMatch[1] | ||
var wrap = map[tag] || map._default | ||
var depth = wrap[0] | ||
var tag = tagMatch && tagMatch[1] | ||
var wrap = map[tag] || map._default | ||
var depth = wrap[0] | ||
var prefix = wrap[1] | ||
var suffix = wrap[2] | ||
var node = document.createElement('div') | ||
var node = document.createElement('div') | ||
@@ -104,4 +104,5 @@ node.innerHTML = prefix + templateString.trim() + suffix | ||
var child | ||
/* jshint boss:true */ | ||
/* eslint-disable no-cond-assign */ | ||
while (child = node.firstChild) { | ||
/* eslint-enable no-cond-assign */ | ||
frag.appendChild(child) | ||
@@ -139,4 +140,5 @@ } | ||
var child | ||
/* jshint boss:true */ | ||
/* eslint-disable no-cond-assign */ | ||
while (child = clone.firstChild) { | ||
/* eslint-enable no-cond-assign */ | ||
frag.appendChild(child) | ||
@@ -263,2 +265,2 @@ } | ||
: frag | ||
} | ||
} |
@@ -75,4 +75,5 @@ var Cache = require('../cache') | ||
var match, index, value, first, oneTime, twoWay | ||
/* jshint boss:true */ | ||
/* eslint-disable no-cond-assign */ | ||
while (match = tagRE.exec(text)) { | ||
/* eslint-enable no-cond-assign */ | ||
index = match.index | ||
@@ -79,0 +80,0 @@ // push text token |
@@ -128,2 +128,2 @@ var _ = require('../util') | ||
transition[action](op, cb) | ||
} | ||
} |
@@ -35,2 +35,2 @@ var _ = require('../util') | ||
return f | ||
} | ||
} |
@@ -126,3 +126,3 @@ var _ = require('../util') | ||
* there's no explicit js callback. | ||
* - no css transition: | ||
* - no css transition: | ||
* done if there's no explicit js callback. | ||
@@ -309,2 +309,2 @@ * 7. wait for either done or js callback, then call | ||
module.exports = Transition | ||
module.exports = Transition |
@@ -14,3 +14,3 @@ var config = require('../config') | ||
var hasConsole = typeof console !== 'undefined' | ||
/** | ||
@@ -39,3 +39,2 @@ * Log a message. | ||
if (config.debug) { | ||
/* jshint debug: true */ | ||
console.warn((e || new Error('Warning Stack Trace')).stack) | ||
@@ -42,0 +41,0 @@ } |
@@ -210,4 +210,5 @@ var _ = require('./index') | ||
: document.createElement('div') | ||
/* jshint boss:true */ | ||
/* eslint-disable no-cond-assign */ | ||
while (child = el.firstChild) { | ||
/* eslint-enable no-cond-assign */ | ||
rawContent.appendChild(child) | ||
@@ -214,0 +215,0 @@ } |
@@ -85,2 +85,2 @@ // can we use __proto__? | ||
} | ||
})() | ||
})() |
@@ -1,2 +0,2 @@ | ||
var lang = require('./lang') | ||
var lang = require('./lang') | ||
var extend = lang.extend | ||
@@ -9,2 +9,2 @@ | ||
extend(exports, require('./debug')) | ||
extend(exports, require('./options')) | ||
extend(exports, require('./options')) |
@@ -82,3 +82,3 @@ /** | ||
function toUpper (_, c) { | ||
return c ? c.toUpperCase () : '' | ||
return c ? c.toUpperCase() : '' | ||
} | ||
@@ -212,6 +212,6 @@ | ||
Object.defineProperty(obj, key, { | ||
value : val, | ||
enumerable : !!enumerable, | ||
writable : true, | ||
configurable : true | ||
value: val, | ||
enumerable: !!enumerable, | ||
writable: true, | ||
configurable: true | ||
}) | ||
@@ -229,5 +229,5 @@ } | ||
exports.debounce = function(func, wait) { | ||
exports.debounce = function (func, wait) { | ||
var timeout, args, context, timestamp, result | ||
var later = function() { | ||
var later = function () { | ||
var last = Date.now() - timestamp | ||
@@ -242,3 +242,3 @@ if (last < wait && last >= 0) { | ||
} | ||
return function() { | ||
return function () { | ||
context = this | ||
@@ -245,0 +245,0 @@ args = arguments |
@@ -12,7 +12,4 @@ var _ = require('./index') | ||
exports.assertProp = function (prop, value) { | ||
var assertions = prop.assertions | ||
if (!assertions) { | ||
return true | ||
} | ||
var type = assertions.type | ||
var options = prop.options | ||
var type = options.type | ||
var valid = true | ||
@@ -52,3 +49,3 @@ var expectedType | ||
} | ||
var validator = assertions.validator | ||
var validator = options.validator | ||
if (validator) { | ||
@@ -55,0 +52,0 @@ if (!validator.call(null, value)) { |
@@ -236,2 +236,29 @@ var _ = require('./index') | ||
/** | ||
* Ensure all props option syntax are normalized into the | ||
* Object-based format. | ||
* | ||
* @param {Object} options | ||
*/ | ||
function guardProps (options) { | ||
var props = options.props | ||
if (_.isPlainObject(props)) { | ||
options.props = Object.keys(props).map(function (key) { | ||
var val = props[key] | ||
if (!_.isPlainObject(val)) { | ||
val = { type: val } | ||
} | ||
val.name = key | ||
return val | ||
}) | ||
} else if (_.isArray(props)) { | ||
options.props = props.map(function (prop) { | ||
return typeof prop === 'string' | ||
? { name: prop } | ||
: prop | ||
}) | ||
} | ||
} | ||
/** | ||
* Merge two option objects into a new one. | ||
@@ -248,2 +275,3 @@ * Core utility used in both instantiation and inheritance. | ||
guardComponents(child.components) | ||
guardProps(child) | ||
var options = {} | ||
@@ -250,0 +278,0 @@ var key |
@@ -215,3 +215,2 @@ var _ = require('./util') | ||
/** | ||
@@ -218,0 +217,0 @@ * Recrusively traverse an object to evoke all converted |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
507070
19
17016