vue
Advanced tools
Comparing version 0.7.3 to 0.7.4
{ | ||
"name": "vue", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Evan You", |
@@ -1,3 +0,5 @@ | ||
# Vue.js [![Build Status](https://travis-ci.org/yyx990803/vue.png?branch=master)](https://travis-ci.org/yyx990803/vue) | ||
<p align="center"><a href="http://vuejs.org" target="_blank"><img src="http://vuejs.org/images/logo.png"></a></p> | ||
# vue.js [![Build Status](https://travis-ci.org/yyx990803/vue.png?branch=master)](https://travis-ci.org/yyx990803/vue) | ||
> Simple, Fast & Composable MVVM for building interative interfaces. | ||
@@ -4,0 +6,0 @@ |
@@ -24,6 +24,2 @@ var utils = require('../utils'), | ||
visible: function (value) { | ||
this.el.style.visibility = value ? '' : 'hidden' | ||
}, | ||
show: function (value) { | ||
@@ -50,23 +46,4 @@ var el = this.el, | ||
} | ||
}, | ||
style: { | ||
bind: function () { | ||
this.arg = convertCSSProperty(this.arg) | ||
}, | ||
update: function (value) { | ||
this.el.style[this.arg] = value | ||
} | ||
} | ||
} | ||
/** | ||
* convert hyphen style CSS property to Camel style | ||
*/ | ||
var CONVERT_RE = /-(.)/g | ||
function convertCSSProperty (prop) { | ||
if (prop.charAt(0) === '-') prop = prop.slice(1) | ||
return prop.replace(CONVERT_RE, function (m, char) { | ||
return char.toUpperCase() | ||
}) | ||
} |
var utils = require('./utils'), | ||
hasOwn = Object.prototype.hasOwnProperty | ||
hasOwn = Object.prototype.hasOwnProperty, | ||
stringSaveRE = /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, | ||
stringRestoreRE = /"(\d+)"/g | ||
@@ -125,2 +127,4 @@ // Variable extraction scooped from https://github.com/RubyLouvre/avalon | ||
var accessors = '', | ||
has = utils.hash(), | ||
strings = [], | ||
// construct a regex to extract all valid variable paths | ||
@@ -134,14 +138,33 @@ // ones that begin with "$" are particularly tricky | ||
), | ||
body = ('return ' + exp).replace(pathRE, function (path) { | ||
// keep track of the first char | ||
var c = path.charAt(0) | ||
path = path.slice(1) | ||
var val = 'this.' + getRel(path, compiler) + path | ||
body = ('return ' + exp) | ||
.replace(stringSaveRE, saveStrings) | ||
.replace(pathRE, replacePath) | ||
.replace(stringRestoreRE, restoreStrings) | ||
body = accessors + body | ||
function saveStrings (str) { | ||
var i = strings.length | ||
strings[i] = str | ||
return '"' + i + '"' | ||
} | ||
function replacePath (path) { | ||
// keep track of the first char | ||
var c = path.charAt(0) | ||
path = path.slice(1) | ||
var val = 'this.' + getRel(path, compiler) + path | ||
if (!has[path]) { | ||
accessors += val + ';' | ||
// don't forget to put that first char back | ||
return c + val | ||
}) | ||
body = accessors + body | ||
has[path] = 1 | ||
} | ||
// don't forget to put that first char back | ||
return c + val | ||
} | ||
function restoreStrings (str, i) { | ||
return strings[i] | ||
} | ||
return makeGetter(body, exp) | ||
} | ||
} |
85502
54
2617