Posted: August 8th, 2009 | Author: tolleiv | Tags: encodingchain, jQuery, php, web | Comments Off
I just “released” encodechain.com. A little tool which enables to combine various popular PHP conversion methods and to check how they affect your input… feel free to give me some feedback
I’m also not sure whether I choose the right name for it … O_o
Posted: June 15th, 2009 | Author: tolleiv | Tags: jQuery | Comments Off
jQuery 1.3 made a huge step especially towards better performance. But it’s not only the framework, from time to time it’s the developer who should care about performance too. Artzstudio.com made up a really good summary of how you should change your coding-style to achieve a higher performance with jQuery.
In my opinion the most important things are:
- Use ID selectors whenever possible since this can be directly mapped to getElementById() it much faster then all the other selectors
- Use chaining whenever possible since it will reuse the already selected element whichout additional selectors
- Limit direct DOM manipulation obviously browsers don’t like it therefor you should avoid it
- Distinguish between $(window).load() and $(documen).ready()
Besides this single resource there’s also the list with 25 jQuery tips from tvidesign.co.uk which contains lot’s of useful stuff. And of course there are ton’s of cheat sheets lying around in the web – you should at least use one .
Over the last days I did some small steps to clean up the code of my TYPO3 imagemap extension. During that process I wanted to update jQuery from 1.2.6 to 1.3.2. Initially this went fine but after some testing I found this strange error:
[Exception... "'Syntax error, unrecognized expression: #' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>"
Due to the *verbosity* of the message (location “<unknown>” ) it wasn’t obvious for me that what’s going wrong. But right after I found the jQuery-bugtracker log #4323 ($(‘#’ + myID) throws an exception in version 1.3.1 and 1.3.2 if myID is a zero length string) everything was clear. For some reason they’ve made the decission to add some strictness to their API so for the future always validate your selectors before you ask jQuery