Skip to content

Commit

Permalink
提高缓存的命中率
Browse files Browse the repository at this point in the history
  • Loading branch information
qincheng committed Oct 2, 2014
1 parent d4aee76 commit f889dc4
Show file tree
Hide file tree
Showing 6 changed files with 3,578 additions and 3,579 deletions.
8 changes: 4 additions & 4 deletions avalon.js
Expand Up @@ -2278,7 +2278,7 @@

function parseExpr(code, scopes, data) {
var dataType = data.type
var filters = dataType === "html" || dataType === "text" ? data.filters : ""
var filters = data.filters ? data.filters.join("") : ""
var exprId = scopes.map(function(el) {
return el.$id.replace(rproxy, "$1")
}) + code + dataType + filters
Expand Down Expand Up @@ -3896,7 +3896,7 @@
$val: 1,
$key: 1
})
proxy.$id = "$proxy$with" + Math.random()
proxy.$id = ("$proxy$with" + Math.random()).replace(/0\./, "")
return proxy
}
var eachProxyPool = []
Expand Down Expand Up @@ -3930,7 +3930,7 @@
proxy.$watch(param, function(val) {
data.getter().set(proxy.$index, val)
})
proxy.$id = "$proxy$" + data.type + Math.random()
proxy.$id = ("$proxy$" + data.type + Math.random()).replace(/0\./, "")
return proxy
}
function recycleEachProxies(array) {
Expand Down Expand Up @@ -3995,7 +3995,7 @@
// <a href="jav&#x09;ascript:alert('XSS');">IE67chrome</a>
// <a href="jav&#x0A;ascript:alert('XSS');">IE67chrome</a>
sanitize: function(str) {
return str.replace(rscripts, "").replace(ropen, function(a, b) {
return str.replace(rscripts, "").replace(ropen, function(a, b) {
var match = a.toLowerCase().match(/<(\w+)\s/)
if (match) {//处理a标签的href属性,img标签的src属性,form标签的action属性
var reg = rsanitize[match[1]]
Expand Down
12 changes: 6 additions & 6 deletions avalon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions avalon.modern.js
Expand Up @@ -1734,7 +1734,7 @@

function parseExpr(code, scopes, data) {
var dataType = data.type
var filters = dataType === "html" || dataType === "text" ? data.filters : ""
var filters = data.filters ? data.filters.join("") : ""
var exprId = scopes.map(function(el) {
return el.$id.replace(rproxy, "$1")
}) + code + dataType + filters
Expand Down Expand Up @@ -3103,7 +3103,7 @@
$val: 1,
$key: 1
})
proxy.$id = "$proxy$with" + Math.random()
proxy.$id = ("$proxy$with" + Math.random()).replace(/0\./, "")
return proxy
}
var eachProxyPool = []
Expand Down Expand Up @@ -3138,7 +3138,7 @@
proxy.$watch(param, function(val) {
data.getter().set(proxy.$index, val)
})
proxy.$id = "$proxy$" + data.type + Math.random()
proxy.$id = ("$proxy$" + data.type + Math.random()).replace(/0\./, "")
return proxy
}
function recycleEachProxies(array) {
Expand Down

0 comments on commit f889dc4

Please sign in to comment.