Mercurial > urweb
comparison lib/js/urweb.js @ 905:7a4b026e45dd
Library improvements; proper list [un]urlification; remove server-side ServerCalls; eta reduction in type inference
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 09 Aug 2009 16:13:27 -0400 |
parents | 63114a2e5075 |
children | 771449d8b411 |
comparison
equal
deleted
inserted
replaced
904:6d9538ce94d8 | 905:7a4b026e45dd |
---|---|
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 var arr = dummy.getElementsByTagName("tbody"); |
308 firstChild = null; | 308 firstChild = null; |
309 if (arr.length > 0) { | 309 if (arr.length > 0 && table != null) { |
310 var tbody = arr[0], next; | 310 var tbody = arr[0], next; |
311 firstChild = document.createElement("script"); | 311 firstChild = document.createElement("script"); |
312 table.insertBefore(firstChild, x); | 312 table.insertBefore(firstChild, x); |
313 for (var node = tbody.firstChild; node; node = next) { | 313 for (var node = tbody.firstChild; node; node = next) { |
314 next = node.nextSibling; | 314 next = node.nextSibling; |
321 runScripts(dummy); | 321 runScripts(dummy); |
322 var table = x.parentNode; | 322 var table = x.parentNode; |
323 | 323 |
324 var arr = dummy.getElementsByTagName("tr"); | 324 var arr = dummy.getElementsByTagName("tr"); |
325 firstChild = null; | 325 firstChild = null; |
326 if (arr.length > 0) { | 326 if (arr.length > 0 && table != null) { |
327 var tbody = arr[0], next; | 327 var tbody = arr[0], next; |
328 firstChild = document.createElement("script"); | 328 firstChild = document.createElement("script"); |
329 table.insertBefore(firstChild, x); | 329 table.insertBefore(firstChild, x); |
330 for (var node = tbody.firstChild; node; node = next) { | 330 for (var node = tbody.firstChild; node; node = next) { |
331 next = node.nextSibling; | 331 next = node.nextSibling; |
466 function uf(s) { | 466 function uf(s) { |
467 return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); | 467 return escape(s).replace(new RegExp ("/", "g"), "%2F").replace(new RegExp ("\\+", "g"), "%2B"); |
468 } | 468 } |
469 | 469 |
470 function uu(s) { | 470 function uu(s) { |
471 return unescape(s); | 471 return unescape(s.replace(new RegExp ("\\+", "g"), " ")); |
472 } | |
473 | |
474 function uul(getToken, getData) { | |
475 var tok = getToken(); | |
476 if (tok == "Nil") { | |
477 return null; | |
478 } else if (tok == "Cons") { | |
479 var d = getData(); | |
480 var l = uul(getToken, getData); | |
481 return {_1:d, _2:l}; | |
482 } else | |
483 throw ("Can't unmarshal list (" + tok + ")"); | |
472 } | 484 } |
473 | 485 |
474 | 486 |
475 | 487 |
476 // Remote calls | 488 // Remote calls |