Skip to content

Commit cf37f7e

Browse files
committed
Release-v0.10.6
1 parent 2df1047 commit cf37f7e

File tree

5 files changed

+108
-49
lines changed

5 files changed

+108
-49
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue",
3-
"version": "0.10.5",
3+
"version": "0.10.6",
44
"main": "dist/vue.js",
55
"description": "Simple, Fast & Composable MVVM for building interative interfaces",
66
"authors": ["Evan You <[email protected]>"],

component.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue",
3-
"version": "0.10.5",
3+
"version": "0.10.6",
44
"main": "src/main.js",
55
"author": "Evan You <[email protected]>",
66
"description": "Simple, Fast & Composable MVVM for building interative interfaces",

dist/vue.js

+102-43
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Vue.js v0.10.5
2+
Vue.js v0.10.6
33
(c) 2014 Evan You
44
License: MIT
55
*/
@@ -213,12 +213,14 @@ var config = require('./config'),
213213
ViewModel = require('./viewmodel'),
214214
utils = require('./utils'),
215215
makeHash = utils.hash,
216-
assetTypes = ['directive', 'filter', 'partial', 'effect', 'component']
217-
218-
// require these so Browserify can catch them
219-
// so they can be used in Vue.require
220-
require('./observer')
221-
require('./transition')
216+
assetTypes = ['directive', 'filter', 'partial', 'effect', 'component'],
217+
// Internal modules that are exposed for plugins
218+
pluginAPI = {
219+
utils: utils,
220+
config: config,
221+
transition: require('./transition'),
222+
observer: require('./observer')
223+
}
222224

223225
ViewModel.options = config.globalAssets = {
224226
directives : require('./directives'),
@@ -239,7 +241,7 @@ assetTypes.forEach(function (type) {
239241
}
240242
if (!value) return hash[id]
241243
if (type === 'partial') {
242-
value = utils.toFragment(value)
244+
value = utils.parseTemplateOption(value)
243245
} else if (type === 'component') {
244246
value = utils.toConstructor(value)
245247
} else if (type === 'filter') {
@@ -294,8 +296,8 @@ ViewModel.use = function (plugin) {
294296
/**
295297
* Expose internal modules for plugins
296298
*/
297-
ViewModel.require = function (path) {
298-
return require('./' + path)
299+
ViewModel.require = function (module) {
300+
return pluginAPI[module]
299301
}
300302

301303
ViewModel.extend = extend
@@ -551,6 +553,11 @@ var utils = module.exports = {
551553
*/
552554
toFragment: require('./fragment'),
553555

556+
/**
557+
* Parse the various types of template options
558+
*/
559+
parseTemplateOption: require('./template-parser.js'),
560+
554561
/**
555562
* get a value from an object keypath
556563
*/
@@ -745,7 +752,7 @@ var utils = module.exports = {
745752
}
746753
if (partials) {
747754
for (key in partials) {
748-
partials[key] = utils.toFragment(partials[key])
755+
partials[key] = utils.parseTemplateOption(partials[key])
749756
}
750757
}
751758
if (filters) {
@@ -754,7 +761,7 @@ var utils = module.exports = {
754761
}
755762
}
756763
if (template) {
757-
options.template = utils.toFragment(template)
764+
options.template = utils.parseTemplateOption(template)
758765
}
759766
},
760767

@@ -872,29 +879,12 @@ map.rect = [1, '<svg xmlns="http://www.w3.org/2000/svg" version="1.1">','</svg>'
872879

873880
var TAG_RE = /<([\w:]+)/
874881

875-
module.exports = function (template) {
876-
877-
if (typeof template !== 'string') {
878-
return template
879-
}
880-
881-
// template by ID
882-
if (template.charAt(0) === '#') {
883-
var templateNode = document.getElementById(template.slice(1))
884-
if (!templateNode) return
885-
// if its a template tag and the browser supports it,
886-
// its content is already a document fragment!
887-
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
888-
return templateNode.content
889-
}
890-
template = templateNode.innerHTML
891-
}
892-
882+
module.exports = function (templateString) {
893883
var frag = document.createDocumentFragment(),
894-
m = TAG_RE.exec(template)
884+
m = TAG_RE.exec(templateString)
895885
// text only
896886
if (!m) {
897-
frag.appendChild(document.createTextNode(template))
887+
frag.appendChild(document.createTextNode(templateString))
898888
return frag
899889
}
900890

@@ -905,7 +895,7 @@ module.exports = function (template) {
905895
suffix = wrap[2],
906896
node = document.createElement('div')
907897

908-
node.innerHTML = prefix + template.trim() + suffix
898+
node.innerHTML = prefix + templateString.trim() + suffix
909899
while (depth--) node = node.lastChild
910900

911901
// one element
@@ -1983,14 +1973,24 @@ var Compiler = require('./compiler'),
19831973
* and a few reserved methods
19841974
*/
19851975
function ViewModel (options) {
1986-
// just compile. options are passed directly to compiler
1976+
// compile if options passed, if false return. options are passed directly to compiler
1977+
if (options === false) return
19871978
new Compiler(this, options)
19881979
}
19891980

19901981
// All VM prototype methods are inenumerable
19911982
// so it can be stringified/looped through as raw data
19921983
var VMProto = ViewModel.prototype
19931984

1985+
/**
1986+
* init allows config compilation after instantiation:
1987+
* var a = new Vue(false)
1988+
* a.init(config)
1989+
*/
1990+
def(VMProto, '$init', function (options) {
1991+
new Compiler(this, options)
1992+
})
1993+
19941994
/**
19951995
* Convenience function to get a value from
19961996
* a keypath
@@ -2048,8 +2048,8 @@ def(VMProto, '$unwatch', function (key, callback) {
20482048
/**
20492049
* unbind everything, remove everything
20502050
*/
2051-
def(VMProto, '$destroy', function () {
2052-
this.$compiler.destroy()
2051+
def(VMProto, '$destroy', function (noRemove) {
2052+
this.$compiler.destroy(noRemove)
20532053
})
20542054

20552055
/**
@@ -2145,6 +2145,7 @@ function query (el) {
21452145
}
21462146

21472147
module.exports = ViewModel
2148+
21482149
});
21492150
require.register("vue/src/binding.js", function(exports, require, module){
21502151
var Batcher = require('./batcher'),
@@ -3150,6 +3151,55 @@ exports.eval = function (exp, compiler, data) {
31503151
}
31513152
return res
31523153
}
3154+
});
3155+
require.register("vue/src/template-parser.js", function(exports, require, module){
3156+
var toFragment = require('./fragment');
3157+
3158+
/**
3159+
* Parses a template string or node and normalizes it into a
3160+
* a node that can be used as a partial of a template option
3161+
*
3162+
* Possible values include
3163+
* id selector: '#some-template-id'
3164+
* template string: '<div><span>my template</span></div>'
3165+
* DocumentFragment object
3166+
* Node object of type Template
3167+
*/
3168+
module.exports = function(template) {
3169+
var templateNode;
3170+
3171+
if (template instanceof window.DocumentFragment) {
3172+
// if the template is already a document fragment -- do nothing
3173+
return template
3174+
}
3175+
3176+
if (typeof template === 'string') {
3177+
// template by ID
3178+
if (template.charAt(0) === '#') {
3179+
templateNode = document.getElementById(template.slice(1))
3180+
if (!templateNode) return
3181+
} else {
3182+
return toFragment(template)
3183+
}
3184+
} else if (template.nodeType) {
3185+
templateNode = template
3186+
} else {
3187+
return
3188+
}
3189+
3190+
// if its a template tag and the browser supports it,
3191+
// its content is already a document fragment!
3192+
if (templateNode.tagName === 'TEMPLATE' && templateNode.content) {
3193+
return templateNode.content
3194+
}
3195+
3196+
if (templateNode.tagName === 'SCRIPT') {
3197+
return toFragment(templateNode.innerHTML)
3198+
}
3199+
3200+
return toFragment(templateNode.outerHTML);
3201+
}
3202+
31533203
});
31543204
require.register("vue/src/text-parser.js", function(exports, require, module){
31553205
var openChar = '{',
@@ -3354,6 +3404,7 @@ filters.lowercase = function (value) {
33543404
* 12345 => $12,345.00
33553405
*/
33563406
filters.currency = function (value, sign) {
3407+
value = parseFloat(value)
33573408
if (!value && value !== 0) return ''
33583409
sign = sign || '$'
33593410
var s = Math.floor(value).toString(),
@@ -4271,7 +4322,9 @@ module.exports = {
42714322
var el = this.iframeBind
42724323
? this.el.contentWindow
42734324
: this.el
4274-
el.removeEventListener(this.arg, this.handler)
4325+
if (this.handler) {
4326+
el.removeEventListener(this.arg, this.handler)
4327+
}
42754328
},
42764329

42774330
unbind: function () {
@@ -4571,13 +4624,19 @@ module.exports = {
45714624
},
45724625

45734626
update: function (value) {
4574-
var prop = this.prop
4627+
var prop = this.prop,
4628+
isImportant
4629+
/* jshint eqeqeq: true */
4630+
// cast possible numbers/booleans into strings
4631+
if (value != null) value += ''
45754632
if (prop) {
4576-
var isImportant = value.slice(-10) === '!important'
4577-
? 'important'
4578-
: ''
4579-
if (isImportant) {
4580-
value = value.slice(0, -10).trim()
4633+
if (value) {
4634+
isImportant = value.slice(-10) === '!important'
4635+
? 'important'
4636+
: ''
4637+
if (isImportant) {
4638+
value = value.slice(0, -10).trim()
4639+
}
45814640
}
45824641
this.el.style.setProperty(prop, value, isImportant)
45834642
if (this.prefixed) {

dist/vue.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue",
3-
"version": "0.10.5",
3+
"version": "0.10.6",
44
"author": {
55
"name": "Evan You",
66
"email": "[email protected]",

0 commit comments

Comments
 (0)