Talk by Ben Cherry - js-better-faster
avoid handlers in loops

function makeElem(id) {
return $("<div/>").attr("id", id).click(function () {
alert($(this).attr("id"));
});
}

var i;
for (i = 0; i < 1000; i += 1) {
someParent.append(makeElem(i));
}
this is slow!
javascript  dom  performance  best-practices 
6 weeks ago
« earlier      
3d @font-face abelson abstraction accessories adapter adgregate ads aircrack-ng ajax ajaxian algorithms aliases align alpha amazon analytics andre_the_giant android ant antivirus apache api apple apt apts archiving asi async asynchronous atrix attribute authentication autocomplete automatic-semicolon-insertion average aweber aws babelfish baby background backorder backup backups bandwidth bash battery benchmark berlin best-practices bestpractices billing bitdefender blog blogs bluff blurts boilerplate books bosh brain branch branching browser browsers bug build build-process bulletproof business button c3333 cable caching calculator calculators cat certification certs chain-of-command character charset charts cheats cheatsheet chicago chris_shiflett chrome clients cloud cloudfront code coding collation color columns command-t commandline commentary comments commerce commit community compare comparison compatibility compile complaint compliance computer concatenation conditional-comments configuration conservative contenteditable control convention cookies cooking copyleft cormorant CORS cotweet crack cradle crime crossdomain crowdfactory css css-sprites css-tricks css3 csswg curry currying cycling dao data data-handling database db debian decor decorator delegate demo deploy deployment design detection developer developers development dhtml directions director disqus documentary documentation dom domains dowjones download dprk drag-&-drop dropbox dual-core dvcs dynamic_script_tag e-commerce eagle ec2 eckford ECMA-262-5 ecmascript economics economy editorials email emailmarketing ember.js emma encapsulation endangered_species engine engines environment equal error errors ES-6 ES-Harmony ES.next ethics etsy examples exercises expiring explorer expressions extended extensions extjs eyetracking facebook facebook_open_graph_application_tutorial factory fancybox fb_xd_fragment features federal ffmpeg file-upload filetype:pdf filter financial findit flash flickr flow font fonts food forms forum framework free friendly frontend ftp function functions fundamentals furniture gadgets gallery games GCF gear generator git gitflow github google google+ GPL graph graphics graphs greenpoint grep guidelines h264 hack hacking hacks handgun hardware harmony harsanyi hasLayout height history hoisting home hook hooks hootsuite how-to howto hrecipe html html5 html5_mobile_compatibility_tables http https hub huffpo Hughes humor icons IE ie6 illustrator image image_processing images imap indent infographic infrastructure inline-block insane insertion install interface internet interpreter interview ipad iphone iterative iterator java java6 javadoc javascript javascript_asi_automatic_semicolon_insertion javascript_modules_amd_pubsub_moderator javascript_namespace jobs john join jon_henke jpegtran jquery js jsdoc jsmin jw jwplayer knowledgebase language law layout lazy leftism less letter level liberalism libertarian library lightbox like linux lion list lists load loading lodging log logan_square login loop macbook magazines mailcheck mailchimp maine make malware manager manual maps marketing markup mashups mdb2 media media-queries media:document memcached metadata meteor metrics microformats microsoft migration minification minify mobile mobile-web mobileme mod_rewrite module_pattern modules monads monitoring moore's_law motorola move moving mozy multiple multitouch mvc mysql mysqldump myths n-dimensional named_function_expression namespace naming nasa native negative-zero net-neutrality network networking news nextright node-static node.js node_redis non-blocking north_korea noteworthy nutch nutch_solr_searchengine_ nutrition nyc observer offload online oocss oop open open_source opensource operator optimist optimization oreilly osx osx_lion_hidden_files_finder outage outlook ova packages parasite partial password passwords patch patterns paul-irish paypal payvment pdf pear performance permissions permissive phone phones photo photos php pictogram pinterest platform-objects platforms players plugins plus pms poker politics post ppc ppk preflight prepared pretty printer privacy process production productivity profiling programming project prototype prototypejs provider pst pubsub push python QArt QR-codes quake queries query quirksmode Rachael_Ray range rdf reading real-time realtime rebase recession recipe_markup recipes records recovery reference reflow registration regular relationships remember render repaint resig resolutions resources responsive-design responsive_ads rest retro review reviews RIA rich_snippets roaming roles roubaix RSS ruby s-commerce salary salary_research sample samuel_beckett samurai sass satire savin schema scheme science scope screen screencast scripts search searchengine searchengines secrets security selection self-signed semantic semantics seo seppuku service services session sessions shell_customization shopping sicp sign-in singleton site slides slot-machine smartTVs social socialmedia software software-license solr source space specialized specification speed speedtest sphere sports sql SQL_Injection square standards starbucks state statements statistics stats sticky-bar stocks strategy streaming streams strict_mode style style-guide subdirectory subdomain subversion subway support sussman svn sxsw sync syntax syntaxhighlighting sysadmin systems tabs taglist tarmac taxes tech_news technews technology techtalks telecommunications tesseract test testing text themes tickers tilde time-warner tinymce tips title To_Read toddlers tomcat tomcat6 tools top top_plugins tracking traffic training translation transparency travel trip_planners troubleshooting tshirts tutorial tutorials twitter typography ubuntu ui uk unary unemployment unicode upgrade upload ups url urls usability usage user username utf-8 utilities VAST vector vendor-prefixes versioncontrol versus video videos viewport vim vim_configuration vim_git_configuration_best-practices_ vim_keyboard_shortcuts vim_plugins_configuration vimeo vimgrep virtualpc web web-performance web2.0 web_elements web_services webcast webcasts webdesign webdev webm website Webstats wep widgets wifi wiki wikivs windows wired wireless withholding wolfenstein wolfram wordpress work workflow wpa wpa_supplicant xfbml xhtml xml xml2js xmlhttprequest xmpp xobni yahoo youtube yuicompressor z-index zend zsh

Copy this bookmark:



description:


tags: