mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-13 08:56:40 +08:00
fix(jqLite): make attr() compatible with jQuery 1.6.4
The behavior of attr() getter and setter changed in jQuery 1.6 and now they treat element properties and attributes as two different things, but in order to not break everyone there is a partial backwards compatibility for checking and updating element properties as well. see http://api.jquery.com/prop/ for more info.
This commit is contained in:
@@ -255,9 +255,15 @@ forEach({
|
||||
attr: function(element, name, value){
|
||||
if (SPECIAL_ATTR[name]) {
|
||||
if (isDefined(value)) {
|
||||
element[name] = !!value;
|
||||
if (!!value) {
|
||||
element[name] = true;
|
||||
element.setAttribute(name, name);
|
||||
} else {
|
||||
element[name] = false;
|
||||
element.removeAttribute(name);
|
||||
}
|
||||
} else {
|
||||
return element[name];
|
||||
return (element[name] || element.getAttribute(name)) ? name : undefined;
|
||||
}
|
||||
} else if (isDefined(value)) {
|
||||
element.setAttribute(name, value);
|
||||
|
||||
Reference in New Issue
Block a user