comparison lib/js/urweb.js @ 1681:e8a84494d2c0

Fix runtime system handling of <dyn> inside <table> inside <dyn>
author Adam Chlipala <adam@chlipala.net>
date Sun, 22 Jan 2012 20:25:14 -0500
parents d05299e561c8
children 225b87d4a7df
comparison
equal deleted inserted replaced
1680:5b2c7b9f6017 1681:e8a84494d2c0
697 while (table.tagName != "TABLE") 697 while (table.tagName != "TABLE")
698 table = table.parentNode; 698 table = table.parentNode;
699 699
700 for (var tbody = table.firstChild; tbody; tbody = tbody.nextSibling) { 700 for (var tbody = table.firstChild; tbody; tbody = tbody.nextSibling) {
701 if (tbody.tagName == "TBODY") { 701 if (tbody.tagName == "TBODY") {
702 var firstChild = tbody.firstChild;
703
702 for (script = table.firstChild; script && script != tbody; script = next) { 704 for (script = table.firstChild; script && script != tbody; script = next) {
703 next = script.nextSibling; 705 next = script.nextSibling;
704 706
705 tbody.insertBefore(script, tbody.firstChild); 707 if (firstChild)
708 tbody.insertBefore(script, firstChild);
709 else
710 tbody.appendChild(script);
706 } 711 }
707 712
708 return; 713 return;
709 } 714 }
710 } 715 }
711 716
712 var tbody = document.createElement("tbody"); 717 var tbody = document.createElement("tbody");
713 for (script = table.firstChild; script; script = next) { 718 for (script = table.firstChild; script; script = next) {
714 next = script.nextSibling; 719 next = script.nextSibling;
715 720
716 tbody.insertBefore(script, tbody.firstChild); 721 tbody.appendChild(script);
717 } 722 }
718 table.appendChild(tbody); 723 table.appendChild(tbody);
719 } 724 }
720 725
721 function dyn(pnode, s) { 726 function dyn(pnode, s) {