Skip to content

Commit

Permalink
fix ms-value不等同于 ms-attr-value BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Nov 17, 2014
1 parent 84c9ec1 commit a0d17a8
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 208 deletions.
6 changes: 3 additions & 3 deletions avalon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@
function bindingSorter(a, b) {
return a.priority - b.priority
}

var obsoleteAttrs = oneObject("value,title,alt,checked,selected,disabled,readonly,enabled")
function scanAttr(elem, vmodels) {
//防止setAttribute, removeAttribute时 attributes自动被同步,导致for循环出错
var attributes = getAttributes ? getAttributes(elem) : avalon.slice(elem.attributes)
Expand All @@ -2162,7 +2162,7 @@
if (events[type]) {
param = type
type = "on"
} else if (/^(checked|selected|disabled|readonly|enabled)$/.test(type)) {
} else if (obsoleteAttrs[type]) {
log("ms-" + type + "已经被废弃,请使用ms-attr-*代替")
if (type === "enabled") { //吃掉ms-enabled绑定,用ms-disabled代替
type = "disabled"
Expand Down Expand Up @@ -2643,7 +2643,7 @@
isInnate = attr ? attr.expando === false : attr === null
}
}
if (isInnate) {
if (isInnate || obsoleteAttrs[attrName]) {
elem[attrName] = val
} else {
elem.setAttribute(attrName, val)
Expand Down
Loading

0 comments on commit a0d17a8

Please sign in to comment.