Mercurial > urweb
comparison lib/js/urweb.js @ 1790:56b8efff64e7
Nicer <active> semantics
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 22 Jul 2012 09:42:17 -0400 |
parents | d794149b3713 |
children | 2f8b8952fe27 |
comparison
equal
deleted
inserted
replaced
1789:2e01a36701eb | 1790:56b8efff64e7 |
---|---|
801 if (pnode == "table") { | 801 if (pnode == "table") { |
802 normalizeTable(x.parentNode); | 802 normalizeTable(x.parentNode); |
803 | 803 |
804 var dummy = document.createElement("body"); | 804 var dummy = document.createElement("body"); |
805 dummy.innerHTML = "<table>" + html + "</table>"; | 805 dummy.innerHTML = "<table>" + html + "</table>"; |
806 runScripts(dummy); | |
807 var table = x.parentNode; | 806 var table = x.parentNode; |
808 | 807 |
809 if (table) { | 808 if (table) { |
810 firstChild = null; | 809 firstChild = null; |
811 var tbody; | 810 var tbody; |
829 firstChild = document.createElement("script"); | 828 firstChild = document.createElement("script"); |
830 table.insertBefore(firstChild, x); | 829 table.insertBefore(firstChild, x); |
831 for (var node = tbody.firstChild; node; node = next) { | 830 for (var node = tbody.firstChild; node; node = next) { |
832 next = node.nextSibling; | 831 next = node.nextSibling; |
833 table.insertBefore(node, x); | 832 table.insertBefore(node, x); |
833 runScripts(node); | |
834 } | 834 } |
835 } | 835 } |
836 } else if (pnode == "tr") { | 836 } else if (pnode == "tr") { |
837 var dummy = document.createElement("body"); | 837 var dummy = document.createElement("body"); |
838 dummy.innerHTML = "<table><tr>" + html + "</tr></table>"; | 838 dummy.innerHTML = "<table><tr>" + html + "</tr></table>"; |
839 runScripts(dummy); | |
840 var table = x.parentNode; | 839 var table = x.parentNode; |
841 | 840 |
842 if (table) { | 841 if (table) { |
843 var arr = dummy.getElementsByTagName("tr"); | 842 var arr = dummy.getElementsByTagName("tr"); |
844 firstChild = null; | 843 firstChild = null; |
852 firstChild = document.createElement("script"); | 851 firstChild = document.createElement("script"); |
853 table.insertBefore(firstChild, x); | 852 table.insertBefore(firstChild, x); |
854 for (var node = tr.firstChild; node; node = next) { | 853 for (var node = tr.firstChild; node; node = next) { |
855 next = node.nextSibling; | 854 next = node.nextSibling; |
856 table.insertBefore(node, x); | 855 table.insertBefore(node, x); |
856 runScripts(node); | |
857 } | 857 } |
858 } | 858 } |
859 } else { | 859 } else { |
860 firstChild = document.createElement("span"); | 860 firstChild = document.createElement("span"); |
861 firstChild.innerHTML = html; | 861 firstChild.innerHTML = html; |
862 runScripts(firstChild); | |
863 if (x.parentNode) | 862 if (x.parentNode) |
864 x.parentNode.insertBefore(firstChild, x); | 863 x.parentNode.insertBefore(firstChild, x); |
864 runScripts(firstChild); | |
865 } | 865 } |
866 }; | 866 }; |
867 | 867 |
868 addNode(x); | 868 addNode(x); |
869 populate(x); | 869 populate(x); |