Detail delete lock Revision 646166313238 (Tue Feb 17 2009 at 06:49) - Diff Link to this snippet: https://friendpaste.com/WgMzFX0bHyrfD4iGmK1D9 Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script src="lib/jquery-1.2.6.pack.js" type="text/javascript"></script> <script src="lib/chain.js" type="text/javascript"></script> <script type="text/javascript"> $.Chain.extend('chain', { defaultBuilder: function(builder, root) { var res = builder ? (builder.apply(this, [root]) !== false) : true; var func = function(data, path) { for(var i in data) { if(typeof data[i] == 'object') { func.call(this, data[i], path ? (path+'.'+i) : i); } else if(typeof data[i] != 'function') { var name = (path ? (path+'.'+i) : i).replace(/(\W)/g, '\\$1'); this.find('> .'+name+', *:not(.chain-element) .'+name) .each(function(){ var match = $(this); if(match.filter(':input').length) {match.val(data[i]);} else if(match.filter('img').length) {match.attr('src', data[i]);} else {match.html(data[i]);} }); } } } if(res) { this.bind('update', function(event, data){ var self = $(this); func.call(self, data); }); } } }); $(function(){ $('#info') .items([ { "@attributes":{name: 'Braeburn', value: 'Eating'} }, { "@attributes":{name: 'Bramley', value: 'Cooking'} }, ]) .chain(); }) </script> </head> <body> <table border="1" cellspacing="5" cellpadding="5"> <tbody id="info"> <tr> <td class="@attributes.name">Test</td> <td><input type="text" class="@attributes.value"/></td> </tr> </tbody> </table> </body> </html>