If you’re a fan of John Resig’s blog (jQuery creator), you may have caught his article on Degrading Script Tags.
He’s come up with a new enhancement for the jQuery library to make better use of your script tags.
Suppose while you’re developing you need to include a script library, and then initialise that library.
<script src="some-lib.js"></script> <script> var foo = use_some_lib(); foo.do.stuff(); </script>
Why can’t we just use the one script tag?
Well John has a method where you can do just that with your script tags:
<script src="some-lib.js"> var foo = use_some_lib(); foo.do.stuff(); </script>
Much cleaner and more efficient isn’t it?
To see how you can modify the jQuery library to support this feature, check out John’s article here.