François Zaninotto schreef:
> Hi list,
>  
> I just pop in to mention a new plugin for the symfony framework 
> (http://www.symfony-project.com) that uses jQuery to implement 
> unobtrusive scripting. It's still in its infancy, but it takes the 
> best of the jQuery syntax concision and provides useful tools for 
> interface developers who worry about accessibility.
>  
> The plugin description is available at:
>  
> http://www.symfony-project.com/trac/wiki/sfUJSPlugin
>  
I took a look at the demo's on the plugin page and the first thing i 
noticed was the use of the onclick event. My idea of unobtrusive 
scripting is to strip as much javascript as possible out of the html code.

wouldn't it be possible to do something like this

<html>
<head>
<title>test</title>
<?php UJS_Placeholder(); ?>
</head>
<body>
<div id="foobar"click me</div>

<?php UJS_add_behaviour('#foobar', 'click', "alert('foobar')") ?>
</body>
</html>

and render it like this

<html>
<head>
<title>test</title>
<script type="javascript">
$(function(){

$('#foobar').click(function() { alert('foobar') });


});
</script>
<body>
<div id="foobar"click me</div>

</body>
</html>

i'm just thinking aloud. It could also be good to cache the javascript 
like this
<?php UJS_Placeholder('/js/testpage.js'); ?>

Anyway nice work. I feels good to see jquery hooked into php, before we 
know it will be the prototype library of php :)

-- 
David Duymelinck
________________
[EMAIL PROTECTED]


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to