diff --git a/src/Compiler.js b/src/Compiler.js index 23bce0840b61..90bcf1c674c1 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -33,7 +33,15 @@ Template.prototype = { paths = this.paths, length = paths.length; for (i = 0; i < length; i++) { - children[i].link(jqLite(childNodes[paths[i]]), childScope); + // sometimes `element` can be modified by one of the linker functions in `this.linkFns` + // and childNodes may be added or removed + // TODO: element structure needs to be re-evaluated if new children added + // if the childNode still exists + if (childNodes[paths[i]]) + children[i].link(jqLite(childNodes[paths[i]]), childScope); + else + // if child no longer available, delete path + delete paths[i]; } }, diff --git a/src/widget/select.js b/src/widget/select.js index 8184d8f9ff95..4aa4cdd00f5c 100644 --- a/src/widget/select.js +++ b/src/widget/select.js @@ -242,9 +242,13 @@ angularWidget('select', function(element){ // find existing special options forEach(selectElement.children(), function(option){ - if (option.value == '') + if (option.value == '') { // User is allowed to select the null. - nullOption = {label:jqLite(option).text(), id:''}; + // save