Quoting Sam Lindley <[EMAIL PROTECTED]>:
Hi Tom,
Good to see that you've started playing with Links :-)
I probably shouldn't be, as I'm supposed to be revising.. But I thought
I might as well. ;-)
I'm a little confused as to exactly what the problem is. I copied your
code, removed all references to undefined functions and changed l:href
to l:onclick, and it behaved as I'd expect.
(Btw: calling the repl() function throws a JavaScript exception because
JavaScript does not let you replace the document node.)
Could you post a short, but complete, code snippet. Then, hopefully I'll
be able to understand what the problem is and perhaps suggest a fix.
Ok, I just tried running this:
#!/usr/local/src/links-0.4/links --config=/usr/lib/cgi-bin/config
fun getMenu()
{
<#>
<table cellpadding="6" cellspacing="0">
<tr>
<td><a
l:onclick="{replaceNode(<h1>nothing</h1>,getNodeById("content"))}">replace</a></td>
</tr>
</table>
</#>
}
fun content ()
{
<div id="menu">{getMenu()}</div>
<div id="content">
</div>
}
# Main HTML generation
# Takes a function, and includes its output on the page
fun main(funct)
{
<html>
<head>
</head>
<body>
<div id="top">
{funct()}
</div>
</body>
</html>
}
main(content)
This gives me a blank page with the following source (sorry, it's messy..):
<html>
<head>
<script type='text/javascript' src="/scripts/json.js"></script>
<script type='text/javascript' src="/scripts/regex.js"></script>
<script type='text/javascript' src="/scripts/yahoo/YAHOO.js"></script>
<script type='text/javascript' src="/scripts/yahoo/event.js"></script>
<script type='text/javascript'>var DEBUGGING=false;</script>
<script type='text/javascript' src="/scripts/jslib.js"></script>
<script type='text/javascript'><!--
function _getDatabaseConfig() {
return {driver:'mysql', args:'<database-args-removed>'}
}
var getDatabaseConfig = _continuationize(_getDatabaseConfig, 0);
function (__kappa){ _yield(main, content, __kappa); }
var main; (main_g8 = function (funct_g7, __kappa){ stringToXml(['\n',
' ', ' '], function (_g35){ stringToXml(['\n', ' ', ' '], function
(_g13){ _XML('head', {}, [_g13], function (_g36){ stringToXml(['\n',
' ', ' '], function (_g37){ stringToXml(['\n', ' ', ' ', ' ', ' '],
function (_g30){ _yieldCont(function (_g18){ stringToXml(['\n', ' ',
' ', ' ', ' ', ' ', ' '], function (_g25){ _yield(funct_g7, {},
function (_g26){ stringToXml(['\n', ' ', ' ', ' ', ' '], function
(_g27){ _XML('div', {'id':_g18}, [_g25, _g26, _g27], function (_g31){
stringToXml(['\n', ' ', ' '], function (_g32){ _XML('body', {}, [_g30,
_g31, _g32], function (_g38){ stringToXml(['\n'], function (_g39){
_XML('html', {}, [_g35, _g36, _g37, _g38, _g39], __kappa); }); }); });
}); }); }); }); }, ['t', 'o', 'p']); }); }); }); }); }); }, main =
main_g8);;
var content; (content_g42 = function (_g2_g41, __kappa){ (_eq(_g2_g41,
{}) ? _yieldCont(function (_g43){ var _g1_g40;
(_g1_g40 = {}, (_eq(_g1_g40, {}) ? stringToXml(['\n', ' ', ' '],
function (__l){ _yieldCont(function (_g46){ _yieldCont(function
(_g47){ stringToXml(['\n', ' ', ' ', ' '], function (_g72){
stringToXml(['\n', ' ', ' ', ' ', ' '], function (_g67){
stringToXml(['r', 'e', 'p', 'l', 'a', 'c', 'e'], function (_g63){
_XML('a', {'key':_registerFormEventHandlers([{'evName':'onclick',
'handler':function (event){ stringToXml(['n', 'o', 't', 'h', 'i', 'n',
'g'], function (_g59){ _XML('h1', {}, [_g59], function (__e_g53){
getNodeById(['c', 'o', 'n', 't', 'e', 'n', 't'], function (__e_g54){
replaceNode({'2':__e_g54, '1':__e_g53}, _idy); }); }); }); }}]),
'href':['#']}, [_g63], function (_g64){ _XML('td', {}, [_g64],
function (_g68){ stringToXml(['\n', ' ', ' ', ' '], function (_g69){
_XML('tr', {}, [_g67, _g68, _g69], function (_g73){ stringToXml(['\n',
' ', ' '], function (_g74){ _XML('table', {'cellspacing':_g46,
'cellpadding':_g47}, [_g72, _g73, _g74], function (__l_g83){
stringToXml(['\n', ' ', ' '], function (__l_g84){ _yieldCont(function
(_g78){ _XML('div', {'id':_g43}, [_g78], function (__l){
_yieldCont(function (_g79){ stringToXml(['\n', ' ', ' '], function
(_g82){ _XML('div', {'id':_g79}, [_g82], function (__r){
_yieldCont(__kappa, _concat(__l, __r)); }); }); }, ['c', 'o', 'n', 't',
'e', 'n', 't']); }); }, _concat(__l, _concat(__l_g83, _concat(__l_g84,
[])))); }); }); }); }); }); }); }); }); }); }); }, ['6']); }, ['0']);
}) : error('Internal Error: Pattern matching failed', __kappa))); },
['m', 'e', 'n', 'u']) : error('Internal Error: Pattern matching
failed', __kappa)); }, content = content_g42);;
--> </script>
</head>
<!-- $Id: js.ml 905 2007-03-20 17:55:48Z sam $ -->
<body><script type='text/javascript'>
_startTimer();_yield(main, content, _start);
</script></body>
</html>
Hope this'll give you more to go on :-)
Thanks a lot,
Tom
Sam
PS: In the not too distant future we're hoping to replace most uses of
the DOM API and also l:* attributes with a much cleaner system.
_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users
_______________________________________________
links-users mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/links-users