mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00: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:
parent
ab407de54d
commit
8259f10138
1 changed files with 8 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue