diff --git a/src/jqLite.js b/src/jqLite.js index af488abbe220..67b6137d4aed 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -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);