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

Commit ddd7b48

Browse files
committed
fix(jqlite): correctly return attribute value for boolean attrs
Previously, attr would return the passed in attribute name if the this name was set as a property on the element. But in certain cases, it's possible that the property is set, but the attribute is not
1 parent ca509f0 commit ddd7b48

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/jqLite.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,14 @@ forEach({
658658
element.removeAttribute(lowercasedName);
659659
}
660660
} else {
661-
return (element[name] ||
661+
console.log('here', name, element[name], lowercasedName, element.attributes.getNamedItem(name), element.getAttribute(name));
662+
var result = (element[name] ||
662663
(element.attributes.getNamedItem(name) || noop).specified)
663-
? lowercasedName
664+
? element.getAttribute(name)
664665
: undefined;
666+
667+
console.log(result)
668+
return element.getAttribute(name) || undefined;
665669
}
666670
} else if (isDefined(value)) {
667671
element.setAttribute(name, value);

src/ng/directive/ngOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
430430
var unknownOption = jqLite(optionTemplate.cloneNode(false));
431431
unknownOption.val('?');
432432

433-
var options;
434433
var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
434+
var options;
435435

436436

437437
var renderEmptyOption = function() {

0 commit comments

Comments
 (0)