Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(jqLite): make attr() compatible with jQuery 1.6.4
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
IgorMinar committed Sep 16, 2011
1 parent ab407de commit 8259f10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8259f10

Please sign in to comment.