Changeset 6660
- Timestamp:
- 05/05/07 09:39:19 (2 years ago)
- Files:
-
- spinoffs/prototype/branches/dom/CHANGELOG (modified) (1 diff)
- spinoffs/prototype/branches/dom/src/dom.js (modified) (1 diff)
- spinoffs/prototype/branches/dom/test/unit/dom.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/branches/dom/CHANGELOG
r6658 r6660 1 1 *SVN* 2 3 * Make Element#update work for SELECT tags in IE and Opera. [Tobie Langel] 2 4 3 5 * Make Element#insert and Element#update better handle TABLE related elements in IE and Opera. Closes #7776, #8040, #7550, #7776, #7938. [Tobie Langel] spinoffs/prototype/branches/dom/src/dom.js
r6659 r6660 662 662 element.appendChild(node) 663 663 }); 664 } else if(tagName == 'SELECT') { 665 while (element.length > 0) element.remove(element.length - 1); 666 Element._getContentFromAnonymousSelect(html.stripScripts()) 667 .each(function(option) { element.add(option) }); 664 668 } else element.innerHTML = html.stripScripts(); 665 666 669 html.evalScripts.bind(html).defer(); 667 670 return element; 668 671 }; 669 672 } 673 674 Element._getContentFromAnonymousSelect = function(html) { 675 var div = document.createElement('div'); 676 div.innerHTML = '<select>' + html + '</select>'; 677 return $A(div.firstChild.childNodes).map(function(o) { 678 return new Option(o.text, o.value === undefined ? o.value : o.text, o.selected, o.selected); 679 }); 680 }; 670 681 671 682 Element._getContentFromAnonymousTable = function(html, tagName) { spinoffs/prototype/branches/dom/test/unit/dom.html
r6658 r6660 295 295 <table id="table_for_insertions"></table> 296 296 <table id="table_for_row_insertions"><tr id="row_1"></tr></table> 297 <form method="post" action="blah"> 298 <select id="select_for_update" name="select_for_update"> 299 <option>option 1</option> 300 <option>option 2</option> 301 </select> 302 </form> 297 303 <div id="wrap-container"><p id="wrap"></p></div> 298 304 <!-- Tests follow --> … … 522 528 }}, 523 529 530 testElementUpdateInSelect: function() {with(this) { 531 var select = $('select_for_update'); 532 select.update('<option value="3">option 3</option><option selected="selected">option 4</option>'); 533 assertEqual('option 4', select.getValue()); 534 }}, 535 524 536 testElementReplace: function() {with(this) { 525 537 $('testdiv-replace-1').replace('hello from div!');