Skip to content

Commit 2011a0d

Browse files
committed
fix(jqLite): Chrome specific issue for <select required>
When adding an `<option selected="selected">` into the DOM, put the property `selected` to `true`. This works around an issue present at Chrome where the new `<option>` is selected at the DOM not selected at the UI. Closes angular#6828
1 parent 1192531 commit 2011a0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/jqLite.js

+4
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,10 @@ forEach({
904904
var index = element, parent = element.parentNode;
905905
forEach(new JQLite(newElement), function(node){
906906
parent.insertBefore(node, index.nextSibling);
907+
// Workaround for Chrome. Check #6828
908+
if (nodeName_(node) === 'OPTION' && (new JQLite(node)).attr('selected') === 'selected') {
909+
node.selected = true;
910+
}
907911
index = node;
908912
});
909913
},

0 commit comments

Comments
 (0)