Skip to content

Commit

Permalink
data.type == 'duplex'不做替换
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Nov 19, 2014
1 parent bfa45a2 commit c6e751a
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 221 deletions.
34 changes: 15 additions & 19 deletions avalon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2470,20 +2470,22 @@
if (!assigns.length && dataType === "duplex") {
return
}
//https://github.com/RubyLouvre/avalon/issues/583
data.vars.forEach(function(v) {
var reg = new RegExp("\\b" + v + "(?:\\.\\w+|\\[\\w+\\])+", "ig")
code = code.replace(reg, function(_) {
var c = _.charAt(v.length)
if (c === "." || c === "[") {
var name = "var" + String(Math.random()).replace(/^0\./, "")
assigns.push(name + " = " + _)
return name
} else {
return _
}
if (dataType !== "duplex") {
//https://github.com/RubyLouvre/avalon/issues/583
data.vars.forEach(function(v) {
var reg = new RegExp("\\b" + v + "(?:\\.\\w+|\\[\\w+\\])+", "ig")
code = code.replace(reg, function(_) {
var c = _.charAt(v.length)
if (c === "." || c === "[") {
var name = "var" + String(Math.random()).replace(/^0\./, "")
assigns.push(name + " = " + _)
return name
} else {
return _
}
})
})
})
}
//---------------args----------------
if (filters) {
args.push(avalon.filters)
Expand Down Expand Up @@ -2586,12 +2588,6 @@
parseExpr(code, scopes, data)
if (data.evaluator && !noregister) {
data.handler = bindingExecutors[data.handlerName || data.type]
if (data.type === "if") {
console.log(data.evaluator + "")
}
// data.evaluator.toString = function() {
// return data.type + " binding to eval(" + code + ")"
// }
//方便调试
//这里非常重要,我们通过判定视图刷新函数的element是否在DOM树决定
//将它移出订阅者列表
Expand Down
Loading

0 comments on commit c6e751a

Please sign in to comment.