comparison lib/js/urweb.js @ 946:2412cb10c97c

Filters displaying properly
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 16:27:24 -0400
parents 7710f65935b6
children 8c37699de273
comparison
equal deleted inserted replaced
945:7710f65935b6 946:2412cb10c97c
302 var dummy = document.createElement("body"); 302 var dummy = document.createElement("body");
303 dummy.innerHTML = "<table>" + html + "</table>"; 303 dummy.innerHTML = "<table>" + html + "</table>";
304 runScripts(dummy); 304 runScripts(dummy);
305 var table = x.parentNode; 305 var table = x.parentNode;
306 306
307 var arr = dummy.getElementsByTagName("tbody"); 307 if (table) {
308 firstChild = null; 308 var arr = dummy.getElementsByTagName("tbody");
309 var tbody; 309 firstChild = null;
310 if (arr.length > 0 && table != null) 310 var tbody;
311 tbody = arr[0]; 311 if (arr.length > 0 && table != null)
312 else 312 tbody = arr[0];
313 tbody = dummy; 313 else
314 314 tbody = dummy.firstChild;
315 var next; 315
316 firstChild = document.createElement("script"); 316 var next;
317 table.insertBefore(firstChild, x); 317 firstChild = document.createElement("script");
318 for (var node = tbody.firstChild; node; node = next) { 318 table.insertBefore(firstChild, x);
319 next = node.nextSibling; 319 for (var node = tbody.firstChild; node; node = next) {
320 table.insertBefore(node, x); 320 next = node.nextSibling;
321 table.insertBefore(node, x);
322 }
321 } 323 }
322 } else if (pnode == "tr") { 324 } else if (pnode == "tr") {
323 var dummy = document.createElement("body"); 325 var dummy = document.createElement("body");
324 dummy.innerHTML = "<table><tr>" + html + "</tr></table>"; 326 dummy.innerHTML = "<table><tr>" + html + "</tr></table>";
325 runScripts(dummy); 327 runScripts(dummy);
326 var table = x.parentNode; 328 var table = x.parentNode;
327 329
328 var arr = dummy.getElementsByTagName("tr"); 330 if (table) {
329 firstChild = null; 331 var arr = dummy.getElementsByTagName("tr");
330 if (arr.length > 0 && table != null) { 332 firstChild = null;
331 var tbody = arr[0], next; 333 var tbody;
334 if (arr.length > 0 && table != null)
335 tbody = arr[0];
336 else
337 tbody = dummy.firstChild;
338
339 var next;
332 firstChild = document.createElement("script"); 340 firstChild = document.createElement("script");
333 table.insertBefore(firstChild, x); 341 table.insertBefore(firstChild, x);
334 for (var node = tbody.firstChild; node; node = next) { 342 for (var node = tbody.firstChild; node; node = next) {
335 next = node.nextSibling; 343 next = node.nextSibling;
336 table.insertBefore(node, x); 344 table.insertBefore(node, x);