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:
Igor Minar 2011-09-15 21:11:45 +02:00
parent ab407de54d
commit 8259f10138

View file

@ -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);