<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4510178934978408169</id><updated>2011-11-27T16:11:32.859-08:00</updated><category term='creative suite 4'/><category term='psd'/><category term='styling'/><category term='AlphaImageLoader'/><category term='for loop'/><category term='best image preloader'/><category term='DOM2'/><category term='bug'/><category term='rotated'/><category term='firebug'/><category term='visibility'/><category term='repeated characters'/><category term='listener'/><category term='multiple email validation'/><category term='sprite'/><category term='war'/><category term='validation'/><category term='jar'/><category term='chrome'/><category term='xmlhttprequest'/><category term='firefox'/><category term='accessibility'/><category term='position:fixed'/><category term='css'/><category term='javascript engine'/><category term='new Image'/><category term='js'/><category term='DOM1'/><category term='keyboard'/><category term='content not displaying'/><category term='registration'/><category term='transform'/><category term='addListener'/><category term='greasemonkey'/><category term='safari'/><category term='ie9'/><category term='resource bundle'/><category term='xml'/><category term='viewable'/><category term='table'/><category term='fireworks'/><category term='select'/><category term='scope'/><category term='custom scrollbar'/><category term='css3'/><category term='auto-close'/><category term='DOM3'/><category term='inventory'/><category term='translucency'/><category term='rotate'/><category term='css2.1'/><category term='yui compressor'/><category term='size limit'/><category term='userscript'/><category term='dojo'/><category term='disabled input'/><category term='related target'/><category term='view source'/><category term='text'/><category term='svg'/><category term='xml to json'/><category term='transparency'/><category term='form validation'/><category term='ie6'/><category term='ie7'/><category term='mouseout'/><category term='ie6 bug'/><category term='avoid css hack'/><category term='j2ee'/><category term='error'/><category term='mouseover'/><category term='w3c'/><category term='prototype'/><category term='json'/><category term='hover'/><category term='xhr'/><category term='yui'/><category term='separated by semicolon'/><category term='disable text selection'/><category term='dom'/><category term='javascript'/><category term='safari 2'/><category term='bypass onsubmit'/><category term='file size'/><category term='resource archive'/><category term='option'/><category term='embed font'/><category term='jash'/><category term='event'/><category term='mousewheel'/><category term='png'/><category term='cs4'/><category term='internet explorer 6'/><category term='conditional'/><category term='css hack'/><category term='jquery plugin'/><category term='webkit'/><category term='response'/><category term='image preloader'/><category term='shell'/><category term='plugin'/><category term='dom level'/><category term='always remove'/><category term='elementool'/><category term='rounded corners'/><category term='cross-browser'/><category term='ie9 speed'/><category term='height'/><category term='filesize'/><category term='repeated spaces'/><category term='embed'/><category term='row'/><category term='debug'/><category term='screen'/><category term='email validation'/><category term='separated by comma'/><category term='branching'/><category term='innerHTML'/><category term='minification'/><category term='offscreen'/><category term='internet explorer'/><category term='determine'/><category term='photoshop'/><category term='td'/><category term='body'/><category term='ellipse'/><category term='jsp'/><category term='viewport'/><category term='check if'/><category term='expression'/><category term='tr'/><category term='preload images'/><category term='overlay'/><category term='vml'/><category term='font'/><category term='opacity'/><category term='position'/><category term='google chrome'/><category term='ie'/><category term='tar'/><category term='alpha'/><category term='click'/><category term='jquery'/><category term='hasListener'/><category term='short-cut logic'/><category term='namespace'/><category term='kilobytes'/><category term='nodes'/><category term='model'/><category term='bundle'/><category term='problem'/><title type='text'>Presentation Layer</title><subtitle type='html'>Everything pertaining to the presentation layer, but focusing on javascript and css</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>48</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-760023686116281732</id><published>2011-07-14T11:19:00.000-07:00</published><updated>2011-07-14T11:19:50.704-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='psd'/><category scheme='http://www.blogger.com/atom/ns#' term='styling'/><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='photoshop'/><category scheme='http://www.blogger.com/atom/ns#' term='inventory'/><title type='text'>Inventory of text styles for a given psd</title><content type='html'>&lt;p&gt;TODO - create a tool to capture the inventory of text styles for a given psd&lt;/p&gt;

&lt;p&gt;Bonus - batch mode: create an inventory of text styles for all psds in a directory (or at least all open psds).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-760023686116281732?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/760023686116281732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2011/07/inventory-of-text-styles-for-given-psd.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/760023686116281732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/760023686116281732'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2011/07/inventory-of-text-styles-for-given-psd.html' title='Inventory of text styles for a given psd'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4352482700477439112</id><published>2011-05-15T20:17:00.000-07:00</published><updated>2011-05-18T07:59:01.520-07:00</updated><title type='text'>On Site Comment</title><content type='html'>&lt;h2&gt;3rd party comment system&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;fb comments&lt;/li&gt;
&lt;li&gt;disqus&lt;/li&gt;
&lt;li&gt;intense debate&lt;/li&gt;
&lt;li&gt;js-kit&lt;/li&gt;
&lt;li&gt;sezwho&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;self-hosted comments&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;threaded comments&lt;/li&gt;
&lt;li&gt;subscribe to replies&lt;/li&gt;
&lt;li&gt;reply by email&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Anti-spam options (for app-handled comments)&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;akismet (free for personal use, not for commercial use)&lt;/li&gt;
&lt;li&gt;reCaptcha (free, bought by google)&lt;/li&gt;
&lt;li&gt;app's "own" captcha&lt;/li&gt;
&lt;li&gt;moderate all comments&lt;/li&gt;
&lt;li&gt;moderate comments if they contain N or more links (default: N=1)&lt;/li&gt;
&lt;li&gt;only allow comments from authenticated users&lt;/li&gt;
&lt;li&gt;autoapprove comments from a commenter after first approval&lt;/li&gt;
&lt;li&gt;moderate all comments for content items older than X days&lt;/li&gt;
&lt;li&gt;close commenting for content items older than X days&lt;/li&gt;
&lt;li&gt;ip-based throttling (system will only accept N comments per M units of time from a given IP)&lt;/li&gt;
&lt;li&gt;system-wide throttling (system will only accept N SYSTEM-WIDE TOTAL comments per M units of time)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Security by obscurity?&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;require random special inputs&lt;/li&gt;
&lt;li&gt;disallow extraneous inputs&lt;/li&gt;
&lt;li&gt;require that a form take at least N units of time to complete (spammers may
submit immediately, people take at least a couple seconds to type something)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Suggestions from "User-generated spam - Webmaster Tools Help"&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://www.google.com/support/webmasters/bin/answer.py?answer#81749"&gt;http://www.google.com/support/webmasters/bin/answer.py?answer#81749&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;rel#"nofollow"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Use a blacklist to prevent repetitive spamming attempts.&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Google often sees large numbers of fake profiles on one innocent site all
linking to the same domain. Once you find a single spammy profile, make it
simple to remove any others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Add a "report spam" feature to user profiles and friend invitations.&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Your users care about your community and are annoyed by spam too. Let them
help you solve the problem.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Monitor your site for spammy pages.&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;One of the best tools for this is Google Alerts. Set up a site: query using
commercial or adult keywords that you wouldn't expect to see on your site.
Google Alerts is also a great tool to help detect hacked pages. The Keywords
page in Webmaster Tools lists significant keywords found on your site, so it's
a good idea to check this regularly for unexpected and volatile vocabulary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;// (end content from google.com)&lt;/p&gt;

&lt;h2&gt;Further thoughts and links&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use non-descriptive form names (i.e., not "comment")&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.projecthoneypot.org/"&gt;http://www.projecthoneypot.org/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.stopforumspam.com/"&gt;http://www.stopforumspam.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;tiny orwell? (old)&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4352482700477439112?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4352482700477439112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2011/05/comments.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4352482700477439112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4352482700477439112'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2011/05/comments.html' title='On Site Comment'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2587817198380624789</id><published>2010-06-21T11:21:00.000-07:00</published><updated>2010-06-21T11:29:39.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='row'/><category scheme='http://www.blogger.com/atom/ns#' term='height'/><category scheme='http://www.blogger.com/atom/ns#' term='td'/><category scheme='http://www.blogger.com/atom/ns#' term='table'/><category scheme='http://www.blogger.com/atom/ns#' term='tr'/><title type='text'>Table Row Height Reported Wrongly</title><content type='html'>&lt;p&gt;Turns out that in all current browsers there may be a 1 pixel discrepancy between the reported height of a table row and the actual height of the table row.&lt;/p&gt;

&lt;p&gt;Not only that, but identical table rows in the same table may differ in height from each other.&lt;/p&gt;

&lt;img src="http://lh4.ggpht.com/_m9ULsfy0rG0/TB-uTXqPW6I/AAAAAAAAB28/qVaJEdPgNto/table-row-height-reported-wrongly.png" alt="Figure 1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2587817198380624789?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2587817198380624789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2010/06/table-cell-height-not-reported.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2587817198380624789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2587817198380624789'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2010/06/table-cell-height-not-reported.html' title='Table Row Height Reported Wrongly'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_m9ULsfy0rG0/TB-uTXqPW6I/AAAAAAAAB28/qVaJEdPgNto/s72-c/table-row-height-reported-wrongly.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3270983178867229545</id><published>2009-11-20T08:05:00.000-08:00</published><updated>2009-11-20T08:15:29.661-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css3'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript engine'/><category scheme='http://www.blogger.com/atom/ns#' term='css2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='ie9 speed'/><category scheme='http://www.blogger.com/atom/ns#' term='ie9'/><category scheme='http://www.blogger.com/atom/ns#' term='rounded corners'/><title type='text'>IE9 First Look</title><content type='html'>&lt;p&gt;The folks over at the IEBlog just posted &lt;a href="http://blogs.msdn.com/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx"&gt;An early look at IE9 for developers&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Synopsis:&lt;/p&gt;

&lt;p&gt;Javascript: almost as fast as ff 3.5, about half as fast as chrome. They brag about improved js speed, then turn around and slightly downplay the importance of it, pointing to the fact that there are many other factors that affect page render time.&lt;/p&gt;

&lt;p&gt;CSS: They explain why they only got 32/100 on the acid3 test: Regarding the technologies that acid3 tests, "many [are] still in the “working draft” stage of standardization". &lt;span style="color:#666;"&gt;(Editorial: And what? You don't deign to implement things that haven't fully settled down to your satisfaction? You're not getting any brownie points with consumers or developers with that attitude, IE team. Remember the good ol' days when you *invented* and implemented the standards before anyone else? Remember how it was that risk-taking, can-do, forge-ahead attitude that won you the browser war? You won't win this one by waiting for the spec to become 100% final before you dare to touch it.)&lt;/span&gt; Then the good news: we've got rounded corners now. CSS3 selectors seem to be coming along swimmingly, passing 574/578 tests on css3.info.&lt;/p&gt;

&lt;p&gt;But perhaps the best news?&lt;/p&gt;

&lt;p&gt;"We’re changing IE to use the DirectX family of Windows APIs to enable many advances for web developers. The starting point is moving all graphics and text rendering from the CPU to the graphics card using Direct2D and DirectWrite. Graphics hardware acceleration means that rich, graphically intensive sites can render faster while using less CPU."&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3270983178867229545?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3270983178867229545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/11/ie9-first-look.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3270983178867229545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3270983178867229545'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/11/ie9-first-look.html' title='IE9 First Look'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-459690227085257796</id><published>2009-09-25T08:45:00.000-07:00</published><updated>2009-10-22T06:17:14.755-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='preload images'/><category scheme='http://www.blogger.com/atom/ns#' term='image preloader'/><category scheme='http://www.blogger.com/atom/ns#' term='new Image'/><category scheme='http://www.blogger.com/atom/ns#' term='best image preloader'/><title type='text'>Preload Images the Right Way</title><content type='html'>&lt;p&gt;Sure, all of us cringe a little when we see that phrase. Even so, for things like overlays&lt;span&gt;&amp;mdash;&lt;/span&gt;of which modals and tooltips are members&lt;span&gt;&amp;mdash;&lt;/span&gt;preloading the background images is a reasonable thing to do. (I still don't fully endorse it, more on that later.)&lt;sup&gt;&lt;a href="#ftn1"&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;I tried this preload code:&lt;/p&gt;

&lt;pre name="code" class="brush:js"&gt;
(function(){
    var i, img, imageLoader = {
        imagesToLoad: [
            'resources/css/images/btn-default-sprite.png',
            'resources/css/images/bg-tooltip-left.png',
            'resources/css/images/bg-tooltip-right.png',
            'resources/css/images/bg-tooltip-image-left.png',
            'resources/css/images/bg-tooltip-image-right.png'
        ],
        loadedImages: []
    };
    for(i in imageLoader.imagesToLoad){
        img = new Image();
        img.src = imageLoader.imagesToLoad[i];
        imageLoader.loadedImages.push( img );
    }
})();
&lt;/pre&gt;

&lt;p&gt;The images didn't seem to be loading any sooner though. So I put a tracer in the list - an image source reference that I knew didn't exist. Then I fired up the page and looked at fiddler. (I would've looked at firebug's net tab, but I was troubleshooting IE6 specifically.) No 404s. So then I tried this code:&lt;/p&gt;

&lt;pre name="code" class="brush:js"&gt;
(function(){
    var imagesToLoad = [
        'resources/css/images/btn-default-sprite.png',
        'resources/css/images/bg-tooltip-left.png',
        'resources/css/images/bg-tooltip-right.png',
        'resources/css/images/bg-tooltip-image-left.png',
        'resources/css/images/bg-tooltip-image-right.png'
    ];
    $('&amp;lt;div class="no-print" style="position:absolute;left:-9999px"/&amp;gt;')
        .appendTo('body')
        .html('&amp;lt;img src="'+imagesToLoad.join('"/&amp;gt;&amp;lt;img src="')+'"/&amp;gt;');
})();
&lt;/pre&gt;

&lt;p&gt;And I got my 404.&lt;/p&gt;

&lt;p class="ftn" id="ftn1"&gt;For the purposes of this discussion, preloading doesn't mean loading the images before the rest of the page, it means loading them before they're used.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-459690227085257796?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/459690227085257796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/09/preload-images.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/459690227085257796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/459690227085257796'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/09/preload-images.html' title='Preload Images the Right Way'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8116281160231652095</id><published>2009-08-24T04:13:00.000-07:00</published><updated>2009-08-24T04:47:21.174-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='jar'/><category scheme='http://www.blogger.com/atom/ns#' term='w3c'/><category scheme='http://www.blogger.com/atom/ns#' term='resource archive'/><category scheme='http://www.blogger.com/atom/ns#' term='war'/><category scheme='http://www.blogger.com/atom/ns#' term='sprite'/><category scheme='http://www.blogger.com/atom/ns#' term='resource bundle'/><title type='text'>Beyond Sprites - The New WAR</title><content type='html'>&lt;p&gt;I was just looking at a set of image files which are used to decorate custom form elements. I was analyzing how best to turn them into sprites&lt;sup&gt;1&lt;/sup&gt;. One particular set of 3 images caused me to dream up a 'new' web standard: a resource tar.&lt;/p&gt;

&lt;p&gt;The set was a left end-cap, a right end-cap, and a repeatable middle section to accommodate a control of fixed height but variable width. The end caps were say, 20px wide, but the repeatable middle section image was - and only needed to be - 1px wide. Now, if I were to combine the 3 in a stacked sprite, the 1px wide middle section would have to be stretched to the 20px width to match the end-caps. True, widening the middle section would compress well in PNG or GIF format - as it was destined to become -- but these were just 3 of the 20 or so images. I could make the tiny sacrifices along the way and probably create 7 sprites out of the 20 images .. but that's still 7 http requests.&lt;/p&gt;

&lt;p&gt;Maybe right now you're thinking what I was - there should be a way to send all 7 at once. And if there was a way to do *that* - then why muss about with all this sprite nonsense at all&lt;sup&gt;2&lt;/sup&gt;? Just leave the images alone in their 20 separate files, but send them all in one jar. It would be the browser's responsibility to interpret a jar file that came from "http://site.com/path/to/jars/jarfile.jar" and had an internal directory structure of&lt;br/&gt;
/.&lt;br/&gt;
/img/&lt;br/&gt;
/img/1.gif&lt;br/&gt;
/img/2.gif&lt;br/&gt;
...&lt;br/&gt;
so that the images could be referenced in CSS as "http://site.com/path/to/jars/img/1.gif",
"http://site.com/path/to/jars/img/2.gif"...&lt;/p&gt;

&lt;p&gt;So what's with the title phrase "the new WAR"? Sending along the image assets for custom controls is just one application of this new "jar" or "war" file concept. Another is to send a packet that has the base images for a site: the logo and primary site decoration elements. Other people may conceive of other sets of resources that it make sense to combine and send along together in one packet.&lt;/p&gt;

&lt;p class="ftn"&gt;&lt;sup&gt;1&lt;/sup&gt; For an excellent description of sprites, including some fantastic examples, see &lt;a href="http://www.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/"&gt;The Mystery Of CSS Sprites: Techniques, Tools And Tutorials&lt;/a&gt;.&lt;/p&gt;
&lt;p class="ftn"&gt;&lt;sup&gt;2&lt;/sup&gt; Ok, the reason to still create the sprites is so that 'older' browsers - you know, the ones that don't have this as-yet unproposed feature - will still have 7 http requests instead of 20 (instead of the 1 they could have with this!)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8116281160231652095?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8116281160231652095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/beyond-sprites-new-war.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8116281160231652095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8116281160231652095'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/beyond-sprites-new-war.html' title='Beyond Sprites - The New WAR'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8662204514475101066</id><published>2009-08-22T22:37:00.000-07:00</published><updated>2009-08-22T22:49:45.396-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='overlay'/><category scheme='http://www.blogger.com/atom/ns#' term='auto-close'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><category scheme='http://www.blogger.com/atom/ns#' term='body'/><title type='text'>Auto-close open overlays</title><content type='html'>&lt;pre name="code" class="brush:js"&gt;
GLOBAL = {
    //...
    //...
    init:function(){
        //...
        //...
        //wire up language selection .. assuming it will be on [nearly] all pages.
        $('#glb-hdr-toolbar .heading').bind('click keypress',function(e){
            if(!e.keyCode || e.keyCode == 32 || e.keyCode == 13){ //32=space, 13=enter
                var p = this.parentNode;
                $(p).toggleClass('open')
                //keep track of open overlays so that we are able to intelligently auto-close-open-overlays
                GLOBAL.overlays.pushUnique(p);
            }
        });
        
        //wire up intelligent auto-close-open-overlays
        // part of the convention, or 'magic', is that a className of "open" is used to control whether the overlay is 'open'.
        $('body').bind('click keypress',function(e){
            if(!e.keyCode || e.keyCode == 32 || e.keyCode == 13){ //32=space, 13=enter
                var targ = e.target,
                    i = 0,
                    keepOpen,
                    list = GLOBAL.overlays.list;
                ///
                while(targ &amp;&amp; ++i&lt;10){
                    for(var j in list){
                        if(targ == list[j]){
                            keepOpen = list[j];
                        }
                    }
                    targ = targ.parentNode;
                }
                
                for(var j in list){
                    if(keepOpen != list[j]){
                        $(list[j]).removeClass('open'); //or, we could just .hide() it... or similar... 
                    }
                }
                
            }
        });
    },
    
    //keep track of open overlays so that we are able to intelligently auto-close-open-overlays
    overlays:{
        list:[],
        pushUnique:function(o){
            var l = GLOBAL.overlays.list;
            for(var i in l){
                if(l[i] == o) return;
            }
            l.push(o);
        }
    },
    //...
    //...
};
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8662204514475101066?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8662204514475101066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/auto-close-open-overlays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8662204514475101066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8662204514475101066'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/auto-close-open-overlays.html' title='Auto-close open overlays'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-6114858183647050834</id><published>2009-08-12T10:34:00.000-07:00</published><updated>2009-08-22T22:41:06.768-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visibility'/><category scheme='http://www.blogger.com/atom/ns#' term='offscreen'/><category scheme='http://www.blogger.com/atom/ns#' term='content not displaying'/><category scheme='http://www.blogger.com/atom/ns#' term='position'/><title type='text'>Offscreen, not invisible.</title><content type='html'>&lt;p&gt;Ran into this .. had a container that I was hiding with &lt;strong&gt;visibility:hidden&lt;/strong&gt;, while loading markup into it.&lt;/p&gt;

&lt;p&gt;Worked great except, of course, for all versions of IE. IE wouldn't show the badge until you moused over it. I tried all the usual IE slap-in-the-face-so-you-behave tricks to no avail (zoom, position, z-index, background, borders).&lt;/p&gt;

&lt;p&gt;So I chose to hide the container by positioning it offscreen with &lt;strong&gt;left:-9999px&lt;/strong&gt;. Bingo.&lt;/p&gt;

&lt;p&gt;The particular content I was loading was a linkedin iframe badge - the "inline" version off their developer api page. I was loathe to switch over to the "popup" version, and am glad I dodged that bullet.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-6114858183647050834?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/6114858183647050834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/offscreen-not-invisible.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6114858183647050834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6114858183647050834'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/08/offscreen-not-invisible.html' title='Offscreen, not invisible.'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-7427413655621302673</id><published>2009-07-08T10:23:00.001-07:00</published><updated>2009-07-08T10:26:17.557-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='custom scrollbar'/><category scheme='http://www.blogger.com/atom/ns#' term='mousewheel'/><title type='text'>custom scrollbar</title><content type='html'>&lt;p&gt;&lt;a href="http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html"&gt;jScrollPane&lt;/a&gt; .. I've heard bad things about it.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.hesido.com/web.php?page=customscrollbar"&gt;fleXscroll&lt;/a&gt; .. I've used it, it's nice, but it's not free.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.n-son.com/scripts/jsScrolling/"&gt;jsScrolling&lt;/a&gt; .. I haven't used it, but it looks nice and it's free.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-7427413655621302673?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/7427413655621302673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/custom-scrollbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7427413655621302673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7427413655621302673'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/custom-scrollbar.html' title='custom scrollbar'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2615773689859878347</id><published>2009-07-08T06:17:00.000-07:00</published><updated>2009-07-08T06:21:53.733-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='email validation'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple email validation'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='separated by semicolon'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='separated by comma'/><category scheme='http://www.blogger.com/atom/ns#' term='validation'/><category scheme='http://www.blogger.com/atom/ns#' term='form validation'/><title type='text'>Improved email validation, plus multiple emails validation</title><content type='html'>&lt;p&gt;jQuery validation plugin .. was causing ff2 to choke. It also didn't have a multiple-email validator .. or a split-up phone validator -- although on that last one, I highly advise you push back - a phone # field should just be ONE INPUT.&lt;/p&gt;

&lt;pre name="code" class="brush:js"&gt;
/*&lt;!--*/
        // http://docs.jquery.com/Plugins/Validation/Methods/email
        email: function(value, element) {
            // contributed by Dennis Hall
            // simplified enough for ff2 to not choke
            return this.optional(element) || /^\s*[^ &lt;&gt;]+@[^ &lt;&gt;]+\.[a-z]{2,9}\s*$/i.test(value);
        },
    
        email_multiple: function(value, element) {
            // contributed by Dennis Hall
            // simplified enough for ff2 to not choke
            var length = value.length,
                indexOfSeparator = -1,
                isValid = true;
            ///
            for(var i=0;i&lt;length;i++){
                var ch = value.charAt(i);
                if( ch == ',' || ch == ';' || i == length-1){
                    isValid = isValid &amp;&amp; /^\s*[^ &lt;&gt;]+@[^ &lt;&gt;]+\.[a-z]{2,9}\s*$/i.test(value.substring(indexOfSeparator+1, (i==length-1?length:i)));
                    indexOfSeparator = i;
                }
            }
            return this.optional(element) || isValid;
        },
    
        phone3: function(value, element) {
            // contributed by Dennis Hall
            // first field must be of the form "&lt;field name id&gt;-1", and other 2 fields must be of the form "&lt;field name id&gt;-2", "&lt;field name id&gt;-3"
            var idBase = element.id.replace(/-1$/,''),
                values = [value, $('#'+idBase+'-2').val(), $('#'+idBase+'-3').val()],
                requiredLengths = [3,3,4];
            ///
            for(var i=0;i&lt;3;i++){
                if(!/^\d+$/.test(values[i]) || values[i].length != requiredLengths[i]){
                    return false;
                }
            }
            
            return true;
        },
/*--&gt;*/
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2615773689859878347?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2615773689859878347/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/improved-email-validation-plus-multiple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2615773689859878347'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2615773689859878347'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/improved-email-validation-plus-multiple.html' title='Improved email validation, plus multiple emails validation'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5141923306315811306</id><published>2009-07-07T13:39:00.000-07:00</published><updated>2009-07-07T15:52:44.241-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='disable text selection'/><title type='text'>The *real* way to disable text selection</title><content type='html'>&lt;p&gt;I was recently asked by UX to make the text of my fancy custom dropdown selects unselectable. A lot of silly scripts out there that disable text selection are application-unfriendly. They go beyond unselectable and make the element totally non-interactive. But I still want the dropdown to work when you click it. Solution = css for the "good" browsers, and javascript for internet explorer.&lt;/p&gt;

&lt;h4&gt;CSS&lt;/h4&gt;
&lt;pre name="code" class="brush:css;"&gt;
.unselectable{
    -moz-user-select: none;
    -webkit-user-select: none;
}
&lt;/pre&gt;

&lt;h4&gt;JS&lt;/h4&gt;
&lt;pre name="code" class="brush:js;"&gt;
if(document.attachEvent){
    function returnFalseFn(){
        return false;
    }
    jQuery('.unselectable').each(function(){
        this.attachEvent('onselectstart', returnFalseFn);
    });
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5141923306315811306?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5141923306315811306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/real-way-to-disable-text-selection.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5141923306315811306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5141923306315811306'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/07/real-way-to-disable-text-selection.html' title='The *real* way to disable text selection'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2084378603207806383</id><published>2009-06-24T12:47:00.000-07:00</published><updated>2009-07-07T15:54:06.561-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='innerHTML'/><category scheme='http://www.blogger.com/atom/ns#' term='conditional'/><category scheme='http://www.blogger.com/atom/ns#' term='option'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><category scheme='http://www.blogger.com/atom/ns#' term='select'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6 bug'/><category scheme='http://www.blogger.com/atom/ns#' term='branching'/><title type='text'>Strange IE6 bug - show/hide select, hemorrhage option innerHTML</title><content type='html'>&lt;p&gt;We've all had to code up those ever-so-fun branching selects. I chose to implement it by showing or hiding (display:block/none) the container of the label+select corresponding to the appropriate branch. And IE6 decided to hemorrhage option innerHTML onto the page - for 1 of the 3 branches: the middle one. I solved it by adding "position:absolute" to the css for the container.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2084378603207806383?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2084378603207806383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/06/strange-ie6-bug-showhide-select.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2084378603207806383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2084378603207806383'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/06/strange-ie6-bug-showhide-select.html' title='Strange IE6 bug - show/hide select, hemorrhage option innerHTML'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8384666575282833412</id><published>2009-06-12T09:47:00.000-07:00</published><updated>2009-06-12T18:03:10.354-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cross-browser'/><title type='text'>Some cross-browser findings</title><content type='html'>&lt;p&gt;ff2 mac: doesn't understand floating-point percentages (ie: 107.3% = 107%) - ran into this with font sizes.&lt;/p&gt;

&lt;p&gt;ff3 thinks that if your parent is visibility:hidden, but you are visibility:visible, that you should display. (wrong.)&lt;/p&gt;

&lt;p&gt;IE8 VHD from microsoft on vpc2007 is not the same as ie8 in the wild. Button element widths seem to be at least 1px wider in the wild.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8384666575282833412?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8384666575282833412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/06/some-cross-browser-findings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8384666575282833412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8384666575282833412'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/06/some-cross-browser-findings.html' title='Some cross-browser findings'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2021916248209531057</id><published>2009-05-22T17:10:00.001-07:00</published><updated>2009-05-22T17:15:29.505-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='userscript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='elementool'/><category scheme='http://www.blogger.com/atom/ns#' term='greasemonkey'/><title type='text'>A Little Elementool Love</title><content type='html'>&lt;p&gt;I started a google code project because I've been using elementool lately and felt that it needed some help.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://code.google.com/p/elementool-greasemonkey-userscript/"&gt;Elementool firefox greasemonkey userscript&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Current features&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Adds row-highlight rollovers
&lt;/li&gt;
&lt;li&gt;
Click anywhere to go to the only link in that row (that bug)
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suggestions welcome!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2021916248209531057?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2021916248209531057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/little-elementool-love.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2021916248209531057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2021916248209531057'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/little-elementool-love.html' title='A Little Elementool Love'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5080741891478656131</id><published>2009-05-15T06:02:00.000-07:00</published><updated>2009-05-16T07:43:53.968-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='jash'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='shell'/><category scheme='http://www.blogger.com/atom/ns#' term='firebug'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>JASH - debug safari</title><content type='html'>&lt;p&gt;Need to debug javascript/css on .. &lt;gasp&gt; safari? Sure, the thing is coming along in that respect, but its built-in tools and even firebug lite just don't cut it sometimes. Give &lt;a href="http://www.billyreisinger.com/jash/"&gt;JASH&lt;/a&gt; a go.&lt;/p&gt;

&lt;p&gt;(Not sure I'd recommend JASH for ie debugging, since the script debugger / debugbar / ie developer toolbar are a little more convenient)&lt;/p&gt;

&lt;p&gt;UPDATE: I've used JASH a little more, and found it useful a little less.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5080741891478656131?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5080741891478656131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/jash-debug-safari.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5080741891478656131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5080741891478656131'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/jash-debug-safari.html' title='JASH - debug safari'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-6983486107210175401</id><published>2009-05-15T05:50:00.000-07:00</published><updated>2009-05-15T06:04:26.791-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='dojo'/><title type='text'>jQuery settles down with dojo, gains weight</title><content type='html'>&lt;p&gt;Sure, this is months-old news, but still. I remember back in the good ol' days when jQuery was a young, athletic rising star. Then it met dojo and settled down.. and gained weight. Look under the jQuery hood and you'll see .. two libraries blast-welded together, complete with their own separate prenups, er, copyright blocks: jQuery and Sizzle, from the dojo foundation.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-6983486107210175401?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/6983486107210175401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/jquery-settles-down-with-dojo-gains.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6983486107210175401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6983486107210175401'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/jquery-settles-down-with-dojo-gains.html' title='jQuery settles down with dojo, gains weight'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4220949447629050090</id><published>2009-05-13T15:56:00.000-07:00</published><updated>2009-05-13T15:58:46.672-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='disabled input'/><title type='text'>Disabled input fires no events</title><content type='html'>Evidently, a dom node "&amp;lt;input disabled="disabled"/&amp;gt;" will not fire any events, even if you do, say, something as direct as this: "&amp;lt;input disabled="disabled" onclick="alert('clicked it.');"/&amp;gt;"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4220949447629050090?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4220949447629050090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/disabled-input-fires-no-events.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4220949447629050090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4220949447629050090'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/disabled-input-fires-no-events.html' title='Disabled input fires no events'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-7701792258118510784</id><published>2009-05-12T06:21:00.000-07:00</published><updated>2009-07-07T15:34:32.279-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xhr'/><category scheme='http://www.blogger.com/atom/ns#' term='internet explorer'/><category scheme='http://www.blogger.com/atom/ns#' term='xmlhttprequest'/><category scheme='http://www.blogger.com/atom/ns#' term='response'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><category scheme='http://www.blogger.com/atom/ns#' term='size limit'/><title type='text'>IE JSON silent fail - size limit</title><content type='html'>&lt;p&gt;Trying to get a ton (600K) of JSON via XHR into IE.. silently failing. Oh, it fetches the data, it just can't parse the data, either through jQuery's built-in JSON parsing or even by the ol' eval.&lt;/p&gt;

&lt;p&gt;Trimming the data down to 60K, there were no problems. The data is a repeating set of dummy objects, so I'm almost certain that I didn't just happen to trim out some problem section of the data. I'm convinced that IE is choking on the data simply because it is more than it can handle. My guess is that JScript doesn't throw the usual "your script is taking too long to execute" warning when executing a single "eval".&lt;/p&gt;

&lt;p&gt;I 'solved' the problem by ditching XHR and using dynamic script tags:&lt;/p&gt;

&lt;p&gt;&lt;b&gt;data.js&lt;/b&gt;&lt;/p&gt;

&lt;pre name="code" class="brush:js;"&gt;
namespace.onData({theGigantic:json............});
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-7701792258118510784?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/7701792258118510784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/ie-json-silent-fail-size-limit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7701792258118510784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7701792258118510784'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/ie-json-silent-fail-size-limit.html' title='IE JSON silent fail - size limit'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8684015384519640869</id><published>2009-05-02T20:45:00.000-07:00</published><updated>2009-05-02T20:47:11.054-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='png'/><category scheme='http://www.blogger.com/atom/ns#' term='AlphaImageLoader'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><category scheme='http://www.blogger.com/atom/ns#' term='alpha'/><category scheme='http://www.blogger.com/atom/ns#' term='vml'/><title type='text'>ie6 and PNGs</title><content type='html'>&lt;p&gt;Thanks to a tip from Gena Wilson:&lt;/p&gt;

&lt;p&gt;http://www.dillerdesign.com/experiment/DD_belatedPNG/&lt;/p&gt;

&lt;p&gt;The cool part: it doesn't use AlphaImageLoader, it uses VML (Microsoft's idea of svg).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8684015384519640869?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8684015384519640869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/ie6-and-pngs.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8684015384519640869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8684015384519640869'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/ie6-and-pngs.html' title='ie6 and PNGs'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8517424867576440722</id><published>2009-05-02T19:40:00.001-07:00</published><updated>2009-05-02T19:44:18.086-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='css hack'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><category scheme='http://www.blogger.com/atom/ns#' term='cross-browser'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><category scheme='http://www.blogger.com/atom/ns#' term='ie7'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><category scheme='http://www.blogger.com/atom/ns#' term='avoid css hack'/><title type='text'>How to Avoid CSS Hacks</title><content type='html'>&lt;p&gt;I've decided to use a very tiny bit of javascript to free me of css hacks. I already use js to add a class "jsEnabled" to the &amp;lt;html&amp;gt; element so that I can style things differently if I know that javascript is going to swoop in and alter them later (tabs, carousels, etc). Taking this a step further, I put the browser name + version number in the html element classname. Then in the css, you can write ".ie7 .my-div {float:none;}" Sure, we're not supposed to rely on javascript. But we usually do. And this is just for minor tweaks anyway. The site will still *work* with js turned off, you'd just lose that tiny css tweak you made that relies on it.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8517424867576440722?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8517424867576440722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/how-to-avoid-css-hacks.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8517424867576440722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8517424867576440722'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/05/how-to-avoid-css-hacks.html' title='How to Avoid CSS Hacks'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4652347966785003763</id><published>2009-04-23T08:09:00.000-07:00</published><updated>2009-07-07T15:35:28.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='expression'/><category scheme='http://www.blogger.com/atom/ns#' term='position:fixed'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><category scheme='http://www.blogger.com/atom/ns#' term='position'/><title type='text'>ie6 + position:fixed nugget</title><content type='html'>&lt;p&gt;Anyone who hates css expressions .. feel free to leave now, and end up doing the same thing in a more convoluted manner in 'regular' javascript. If it eases your conscience any -- I know it does mine -- this css is sourced in a conditional comment just for ie6&lt;/p&gt;

&lt;pre name="code" class="brush:js;"&gt;
#my-fixed-position-element{
top:expression(Math.max(document.documentElement.scrollTop + (document.getElementsByTagName('html')[0].offsetHeight / 2), 20) + 'px');
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4652347966785003763?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4652347966785003763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/ie6-positionfixed-nugget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4652347966785003763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4652347966785003763'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/ie6-positionfixed-nugget.html' title='ie6 + position:fixed nugget'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3918725815901292476</id><published>2009-04-22T09:14:00.000-07:00</published><updated>2009-07-07T15:35:54.508-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='accessibility'/><category scheme='http://www.blogger.com/atom/ns#' term='keyboard'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><title type='text'>Don't Leave Keyboarders in the Cold</title><content type='html'>&lt;p&gt;A handy jQuery plugin to make it easier to play nice with the keyboard-centric folks and &lt;strong&gt;improve accessibility&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This code assumes the definition of a 'keys' object that identifies keycodes by more readable names, such as &lt;code&gt;keys = {space:32, enter:13};&lt;/code&gt;&lt;/p&gt;

&lt;pre name="code" class="brush:js;"&gt;
    // make a new plugin that handles click + keypress,
    // assuming that hitting space or enter counts as a 'click'.
    $.fn.klik = function(f){
        return this.bind('click keypress', function(e){
            if(!e.keyCode || e.keyCode == keys.space || e.keyCode == keys.enter){
                return f.call(this, e);
            }
        });
    };
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3918725815901292476?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3918725815901292476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/dont-leave-keyboarders-in-cold.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3918725815901292476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3918725815901292476'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/dont-leave-keyboarders-in-cold.html' title='Don&apos;t Leave Keyboarders in the Cold'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2900317716173732450</id><published>2009-04-16T09:38:00.000-07:00</published><updated>2009-07-07T15:36:02.012-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='related target'/><category scheme='http://www.blogger.com/atom/ns#' term='mouseover'/><category scheme='http://www.blogger.com/atom/ns#' term='mouseout'/><title type='text'>Close on MouseOut, Except .. Related Target</title><content type='html'>&lt;p&gt;For a mouseout event, the event target is the thing you're leaving - mousing out of - the event &lt;strong&gt;&lt;em&gt;relatedTarget&lt;/em&gt;&lt;/strong&gt; is the thing you're leaving &lt;strong&gt;&lt;em&gt;to&lt;/em&gt;&lt;/strong&gt;, or entering.&lt;/p&gt;

&lt;pre name="code" class="brush:js;"&gt;
        jQuery('#something').mouseout(function(e){
            /*
                don't close the subnav if we've moused out -&gt; onto an autocomplete resultset.
            */
            var targ = e.relatedTarget, i = 0;
            //we're only checking the most recent 5 parents (ancestors).
            while(targ &amp;&amp; ++i&lt;5){
                //don't close the subnav if we're mousing over an autocomplete list.
                if(targ.className &amp;&amp; targ.className.indexOf('ac_results')&gt;-1){
                    return;
                }
                targ = targ.parentNode;
            }
            /**/
           
            //ok, close me..
            $(this).hide();
        });
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2900317716173732450?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2900317716173732450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/related-target.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2900317716173732450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2900317716173732450'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/related-target.html' title='Close on MouseOut, Except .. Related Target'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2906019785545775468</id><published>2009-04-16T07:51:00.001-07:00</published><updated>2009-07-07T15:36:20.958-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='yui'/><category scheme='http://www.blogger.com/atom/ns#' term='namespace'/><title type='text'>YUI-Like Javascript Namespaces</title><content type='html'>&lt;p&gt;I really like the idea of Javascript namespaces for projects that have a lot of javascript (or even a little javascript on a lot of pages).  YUI has a really good implementation, so I took a look at how they did theirs and ripped out the namespace creation part so I could use it on any project I wanted without having to include the YUI library.&lt;/p&gt;

&lt;p&gt;The biggest benefit to using namespaces is avoidance of collisions.  When using namespaces, you can be sure that no 3rd-party library or other coder is overwriting your functions or properties.  Also, you can also use a javascript compresser / combiner to combine a lot of JS files into 1 JS file in order to reduce the amount of requests you make to the server.  If you use namespaces, you can be sure that when you put all of the JS files together, you won't have any collisions.&lt;/p&gt;

To use the code, first put the following code in a globl js file:
&lt;pre name="code" class="brush:js;"&gt;
if (typeof YourSite == "undefined") {
   var YourSite = {};
}

YourSite.namespace = function() {
    var a = arguments, o = null, i, j, d;
    for (i = 0; i &lt; a.length; i = i + 1) {
        d = a[i].split(".");
        o = window;
        for (j = 0; j &lt; d.length; j = j + 1) {
            o[d[j]] = o[d[j]] || {};
            o = o[d[j]];
        }
    }
    return o;
};
&lt;/pre&gt;

Then for each page or section of your site you can create a namespace:
&lt;pre name="code" class="brush:js;"&gt;
  YourSite.namespace("YourSite.Section1");
&lt;/pre&gt;

Then when creating functions or properties,  you can write:
&lt;pre name="code" class="brush:js;"&gt;
 YourSite.Section1.myProperty = "blah";

 YourSite.Section1.myFunction = function()
 {
     alert(YourSite.Section1.myProperty);
 }

 YourSite.Section1.myFunction();
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2906019785545775468?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2906019785545775468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/yui-like-javascript-namespaces.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2906019785545775468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2906019785545775468'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/yui-like-javascript-namespaces.html' title='YUI-Like Javascript Namespaces'/><author><name>SeyelentEco</name><uri>http://www.blogger.com/profile/17199684772554140727</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4860718570222564942</id><published>2009-04-15T10:16:00.000-07:00</published><updated>2009-07-07T15:37:53.809-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='screen'/><category scheme='http://www.blogger.com/atom/ns#' term='viewport'/><category scheme='http://www.blogger.com/atom/ns#' term='viewable'/><category scheme='http://www.blogger.com/atom/ns#' term='height'/><title type='text'>What's the body's height?</title><content type='html'>&lt;p&gt;Written jQuery-style, but only mildly dependent.&lt;/p&gt;

&lt;p&gt;I needed/wanted this code because I was making a modal overlay and wanted the modality to exactly cover the body. The 'modality' is what I've termed the click-proof smoked-glass panel (div).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; this is not intended to give you the viewport diemensions, but rather the entire [scrollable] document dimensions.&lt;/p&gt;

&lt;pre name="code" class="brush:js;"&gt;
    // var docSize is declared elsewhere
    $(window).resize(function(){
        var h = $('body')[0];
        docSize = {
            width: h.scrollWidth
            ,height: Math.max(
                $('html')[0].scrollHeight, //webkit
                h.scrollHeight, //ff
                document.documentElement.offsetHeight //ie
            )
        };
    });
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4860718570222564942?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4860718570222564942/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/whats-viewable-height.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4860718570222564942'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4860718570222564942'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/04/whats-viewable-height.html' title='What&apos;s the body&apos;s height?'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8256579405830685178</id><published>2009-03-18T07:48:00.000-07:00</published><updated>2009-07-07T15:38:05.550-07:00</updated><title type='text'>'Dynamic' Image Headers</title><content type='html'>&lt;p&gt;Sure, sifr is probably the way to go. Unless it's not. Or the client says no.&lt;/p&gt;

&lt;p&gt;Prerequisite: A text file listing all the headers to be made.&lt;/p&gt;

&lt;p&gt;So, first off, I tried ImageMagick. It worked like a charm for OPAQUE gifs. Then stirred in some fancy masking stuff to clear out all white pixels. Now I had very nice 22pt headers. But the small headers looked miserable. 13pt looked just fine, but 12pt looked terrible. And it had to be 12pt. I tried smoothing commands to no avail.&lt;/p&gt;

&lt;p&gt;So I decided to create one tall image with all the headers by just pasting the text file into fireworks and saving as png8 with transparency. That way, they *look* perfect. And I wrote a &lt;a href="http://processing.org"&gt;processing&lt;/a&gt; script, or "sketch" to create all the headers from the master headerlist-image.&lt;/p&gt;

&lt;h4&gt;Processing Code Snippet&lt;/h4&gt;

&lt;pre name="code" class="brush:js;"&gt;
String[] headlineStrings = {
"HOME",
"ABOUT US",
"ETCETERA",
"THESE ARE NOT THE HEADERS I WAS GIVEN",
"THE LIST WAS 168 HEADERS"
};

int LARGE = 1;
int SMALL = 2;
int usingSize = LARGE;
String mySize = usingSize == LARGE ? "large" : "small";
String prefix = usingSize == LARGE ? "lrg" : "sm";
int myWidth = usingSize == LARGE ? 391 : 213;
int myHeight = usingSize == LARGE ? 16 : 9;
int myOffsetHeight = usingSize == LARGE ? 22 : 12;

PGraphics pg = createGraphics(myWidth, myHeight, JAVA2D);
PImage a = loadImage("c:\\documents and settings\\dennish\\desktop\\columbia headers\\headers-" + mySize + ".png");
//PFont font = loadFont("DispatchCond-Bold-48.vlw");
//PFont font = createFont("DispatchCond-Bold", 12, true);

//String[] fontList = PFont.list();
//println(fontList);

//size(440, 900);
//fill(0);
smooth();

for(int i = 0; i &lt; headlineStrings.length; i++){
    //textFont(font, 12);
    //text(headlineStrings[i], 0, i*12);
    pg.beginDraw();
    pg.background(0,0);
    pg.image(a, 0, 0 - (i * myOffsetHeight)); //12px because the font-size is 12px, and therefore each line of text will occupy 12px vertically.
    pg.endDraw();
    pg.save("c:\\dev\\headlines\\20090317\\hdr-" + prefix + "-" + headlineStrings[i] + ".png");
    pg.dispose();
}
&lt;/pre&gt;

&lt;p&gt;One last problem: these have to be GIFs, and the only way the technique would work so far is by making them PNGs.&lt;/p&gt;
&lt;p&gt;So .. back into fireworks for a &lt;strong&gt;batch&lt;/strong&gt; export. Final gotchya: have to click "edit" next to the filetype export selection dropdown, and make sure the GIF has (alpha) transparency enabled.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8256579405830685178?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8256579405830685178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/dynamic-image-headers.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8256579405830685178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8256579405830685178'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/dynamic-image-headers.html' title='&apos;Dynamic&apos; Image Headers'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5935312787416251396</id><published>2009-03-11T19:44:00.000-07:00</published><updated>2009-03-11T20:26:41.257-07:00</updated><title type='text'>LinkMania</title><content type='html'>&lt;p&gt;&lt;strong&gt;I plan to post more links here over time.&lt;/strong&gt; Linkrot commence!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://webdesignledger.com/"&gt;Web Design Ledger:&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://webdesignledger.com/resources/11-excellent-solutions-for-creating-tooltips"&gt;tooltips&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://scriptandstyle.com/"&gt;Script And Style&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.xtranormal.com/"&gt;XtraNormal&lt;/a&gt; "if you can type, you can make a movie" (maybe useful for storyboarding [real] video shoots?)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have I just become a tool?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5935312787416251396?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5935312787416251396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/linkmania.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5935312787416251396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5935312787416251396'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/linkmania.html' title='LinkMania'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5564301925932501408</id><published>2009-03-11T19:42:00.000-07:00</published><updated>2009-03-11T19:43:46.218-07:00</updated><title type='text'>Can you detect font availability?</title><content type='html'>&lt;p&gt;Speaking of Fonts...&lt;/p&gt;
&lt;p&gt;&lt;a href="http://code.google.com/p/jquery-fontavailable/"&gt;jquery-fontavailable&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5564301925932501408?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5564301925932501408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/can-you-detect-font-availability.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5564301925932501408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5564301925932501408'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/can-you-detect-font-availability.html' title='Can you detect font availability?'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-552122577197024921</id><published>2009-03-11T19:40:00.000-07:00</published><updated>2009-07-07T14:39:10.434-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='accessibility'/><category scheme='http://www.blogger.com/atom/ns#' term='svg'/><category scheme='http://www.blogger.com/atom/ns#' term='embed font'/><category scheme='http://www.blogger.com/atom/ns#' term='font'/><category scheme='http://www.blogger.com/atom/ns#' term='cross-browser'/><category scheme='http://www.blogger.com/atom/ns#' term='embed'/><category scheme='http://www.blogger.com/atom/ns#' term='vml'/><title type='text'>cufón - fonts for the people</title><content type='html'>&lt;p&gt;cufón is a newish sifr [clone].&lt;/p&gt;

&lt;p&gt;Just posting here for my ~ahem~, our future reference.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://cufon.shoqolate.com/"&gt;http://cufon.shoqolate.com/&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-552122577197024921?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/552122577197024921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/cufon-fonts-for-people.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/552122577197024921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/552122577197024921'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/cufon-fonts-for-people.html' title='cufón - fonts for the people'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3058935252158768701</id><published>2009-03-11T19:35:00.001-07:00</published><updated>2009-03-11T19:39:52.605-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='minification'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='j2ee'/><category scheme='http://www.blogger.com/atom/ns#' term='bundle'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>JAWR = awesome, but please make it work with sitemesh</title><content type='html'>&lt;p&gt;Any astute reader out there.. use JAWR on your J2EE projects. It's fabulous. It just doesn't seem to play well with sitemesh (and I put the blame on sitemesh).&lt;/p&gt;

&lt;p&gt;JAWR allows for properties-file-driven bundling + auto-minification (via YUI-Compressor [or your favorite, maybe]) of CSS and JS. It also supports a debug mode, which you can switch on with one variable change.&lt;/p&gt;

&lt;p&gt;Know of a great .NET, PHP, or Python equivalent of JAWR? Please comment!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3058935252158768701?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3058935252158768701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/jawr-awesome-but-please-make-it-work.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3058935252158768701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3058935252158768701'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/jawr-awesome-but-please-make-it-work.html' title='JAWR = awesome, but please make it work with sitemesh'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-119952357327667143</id><published>2009-03-11T19:28:00.000-07:00</published><updated>2009-03-11T19:34:29.775-07:00</updated><title type='text'>H1 &gt; IMG or CSS-Replacement?</title><content type='html'>&lt;p&gt;It always depends on the circumstances, but I'm generally leaning slightly in favor of using img tags in headers instead of the fuss of css image replacement.&lt;p&gt;

&lt;p&gt;And please don't bring up sifr (siffer) - I like, you like it, or maybe neither of us do... but sometimes it just isn't a good fit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;+ Css image replacement: a touch more accessible&lt;/li&gt;
&lt;li&gt;+ IMG tag in the header: faster to code, easier to maintain, unless you've already built/bolted on an automated solution for both the images and the css.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SEO values for either are open to wild speculation, but the general opinion is a tad in favor of the img tag setup. Add to it the dev. time (time=$, no not javascript library, money) you save, and that explains my leaning. Note - leaning - not zealotry or dogmatism, just leaning.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-119952357327667143?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/119952357327667143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/h1-img-or-css-replacement.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/119952357327667143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/119952357327667143'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/03/h1-img-or-css-replacement.html' title='H1 &gt; IMG or CSS-Replacement?'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5359644019955114148</id><published>2009-01-21T07:09:00.000-08:00</published><updated>2009-01-21T07:43:41.579-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><category scheme='http://www.blogger.com/atom/ns#' term='google chrome'/><category scheme='http://www.blogger.com/atom/ns#' term='view source'/><title type='text'>Chrome's view source isn't all there</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_m9ULsfy0rG0/SXc_A3Q_WaI/AAAAAAAAAnE/IWYCe2v0A4Y/s1600-h/google-chrome-view-source.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 231px;" src="http://4.bp.blogspot.com/_m9ULsfy0rG0/SXc_A3Q_WaI/AAAAAAAAAnE/IWYCe2v0A4Y/s320/google-chrome-view-source.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5293769171065067938" /&gt;&lt;/a&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_m9ULsfy0rG0/SXc_A73h1RI/AAAAAAAAAnM/2Zj7F8RGx4A/s1600-h/firefox-view-source.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 230px;" src="http://2.bp.blogspot.com/_m9ULsfy0rG0/SXc_A73h1RI/AAAAAAAAAnM/2Zj7F8RGx4A/s320/firefox-view-source.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5293769172300453138" /&gt;&lt;/a&gt;

&lt;p style="clear:left"&gt;Left: Chrome, Right: Firefox.&lt;/p&gt;

&lt;p&gt;UPDATE: view-source is just making a new request for the page, which does not reflect any posted data--ie. a new blank, initial form.&lt;/p&gt;

&lt;p&gt;Chrome's view-source omitted some text.&lt;/p&gt;

&lt;p&gt;I think it has to do with the "pretty-formatting" that chrome applies to the view source. It was just a sample spring+struts+tiles application I was playing with. It was text that was a direct child of the body tag - not something that I'd ever code that way, but surprising that it didn't show up in view source in chrome.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5359644019955114148?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5359644019955114148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2009/01/chromes-view-source-isnt-100.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5359644019955114148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5359644019955114148'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2009/01/chromes-view-source-isnt-100.html' title='Chrome&apos;s view source isn&apos;t all there'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_m9ULsfy0rG0/SXc_A3Q_WaI/AAAAAAAAAnE/IWYCe2v0A4Y/s72-c/google-chrome-view-source.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-9218876337747691635</id><published>2008-12-24T07:46:00.000-08:00</published><updated>2009-07-07T15:38:14.150-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='repeated characters'/><category scheme='http://www.blogger.com/atom/ns#' term='repeated spaces'/><title type='text'>Quick! way to get repeated characters</title><content type='html'>&lt;p&gt;want 8 spaces?&lt;/p&gt;

&lt;pre class="brush:js;" name="code"&gt;
(new Array(8)).join(' ')
&lt;/pre&gt;

&lt;p&gt;it's quick not only as in fewer keystrokes/less code, but is also blazingly fast to execute compared to a for-loop implementation.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-9218876337747691635?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/9218876337747691635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/12/quick-way-to-get-repeated-characters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/9218876337747691635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/9218876337747691635'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/12/quick-way-to-get-repeated-characters.html' title='Quick! way to get repeated characters'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3253526771791027801</id><published>2008-12-14T20:37:00.000-08:00</published><updated>2008-12-14T20:43:56.378-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fireworks'/><category scheme='http://www.blogger.com/atom/ns#' term='cs4'/><category scheme='http://www.blogger.com/atom/ns#' term='creative suite 4'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='filesize'/><category scheme='http://www.blogger.com/atom/ns#' term='file size'/><category scheme='http://www.blogger.com/atom/ns#' term='kilobytes'/><title type='text'>Fireworks CS4 filesize export bug</title><content type='html'>&lt;p&gt;Fireworks' export wizard seems to be plagued by filesize bugs. I thought they squashed them in CS3, but CS4 seems to have re-introduced or made a new one: it reports an exported file's size as Kilobytes = bytes/1000 instead of bytes/1024.&lt;/p&gt;

&lt;p&gt;I just exported a file, noting that FW tells me it will be 754K, when in fact, it is 737K (754,807 bytes).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3253526771791027801?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3253526771791027801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/12/fireworks.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3253526771791027801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3253526771791027801'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/12/fireworks.html' title='Fireworks CS4 filesize export bug'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3823924679351578843</id><published>2008-10-21T13:42:00.000-07:00</published><updated>2009-07-07T14:39:33.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hover'/><category scheme='http://www.blogger.com/atom/ns#' term='translucency'/><category scheme='http://www.blogger.com/atom/ns#' term='AlphaImageLoader'/><category scheme='http://www.blogger.com/atom/ns#' term='internet explorer 6'/><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><category scheme='http://www.blogger.com/atom/ns#' term='alpha'/><category scheme='http://www.blogger.com/atom/ns#' term='opacity'/><category scheme='http://www.blogger.com/atom/ns#' term='transparency'/><title type='text'>IE6 + AlphaImageLoader + hover</title><content type='html'>the 'filter' nomenclature is unwieldy, so these lines are going to be long, you'll need to scroll.

The gist is - ORDER MATTERS! - and the order is opposite from what you'd expect.

&lt;pre class="brush:js;" name="code"&gt;
/* order matters! */
.carousel a:hover .playbutton{background:transparent url(/css/i/x.gif);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/css/i/icons/playbutton_thumb_hover.png", sizingMethod="crop");}
.carousel .playbutton{background:transparent url(/css/i/x.gif);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/css/i/icons/playbutton_thumb_normal.png", sizingMethod="crop");}
a:hover .playbutton{background:transparent url(/css/i/x.gif);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/css/i/icons/playbutton_hover.png", sizingMethod="crop");}
.playbutton{background:transparent url(/css/i/x.gif);filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/css/i/icons/playbutton_normal.png", sizingMethod="crop");}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3823924679351578843?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3823924679351578843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/ie6-alphaimageloader-hover.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3823924679351578843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3823924679351578843'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/ie6-alphaimageloader-hover.html' title='IE6 + AlphaImageLoader + hover'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4453466742115242475</id><published>2008-10-07T11:52:00.000-07:00</published><updated>2008-10-07T11:58:04.056-07:00</updated><title type='text'>Asynchronously loading javascript</title><content type='html'>Asynchronous allows the page to keep loading--it's non-blocking--which can be nice. But also has gotchyas. With traditional, sequential, synchronously loaded javascript, you can be sure that something is defined if you've defined it in a preceeding script block. Not so with asynch. loaded js.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4453466742115242475?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4453466742115242475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/asynchronously-loading-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4453466742115242475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4453466742115242475'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/asynchronously-loading-javascript.html' title='Asynchronously loading javascript'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-3771595584201048499</id><published>2008-10-07T11:09:00.001-07:00</published><updated>2008-10-07T11:10:16.696-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='bypass onsubmit'/><category scheme='http://www.blogger.com/atom/ns#' term='safari 2'/><title type='text'>Safari 2</title><content type='html'>evidently, form.submit() bypasses any onsubmit handler that may be in play, whether it was added via form.onsubmit = function(){} or by using addEventListener.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-3771595584201048499?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/3771595584201048499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/safari-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3771595584201048499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/3771595584201048499'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/10/safari-2.html' title='Safari 2'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-1164933942545455841</id><published>2008-09-24T12:49:00.000-07:00</published><updated>2009-07-07T15:38:26.851-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='registration'/><category scheme='http://www.blogger.com/atom/ns#' term='hasListener'/><category scheme='http://www.blogger.com/atom/ns#' term='event'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM2'/><category scheme='http://www.blogger.com/atom/ns#' term='determine'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM3'/><category scheme='http://www.blogger.com/atom/ns#' term='check if'/><category scheme='http://www.blogger.com/atom/ns#' term='model'/><category scheme='http://www.blogger.com/atom/ns#' term='dom level'/><category scheme='http://www.blogger.com/atom/ns#' term='listener'/><category scheme='http://www.blogger.com/atom/ns#' term='DOM1'/><category scheme='http://www.blogger.com/atom/ns#' term='addListener'/><title type='text'>Events</title><content type='html'>&lt;pre class="brush:js;" name="code"&gt;

//will break if element.on[event] is modified directly elsewhere
//will break if the markup itself contains inline event listener functions ( &amp;lt;element onevent="function body"&amp;gt; )
//is incompatible with prototype library (Prototype library should not be used for ANY project.)

// using EVENT namespace ... could be different if needed, could possibly be Element.prototype ... could possibly be a jQuery extension/plugin (or incorporated into jQuery core?)

EVENT = {};

EVENT.elements = [];

EVENT.addListener = function(el, type, f, prepend){
    
    if(!el.eventListenerList){
        el.eventListenerList = [];
    }
    
    if(!el.eventListenerList[type]){
        el.eventListenerList[type] = [];
    }
    
    if(prepend){
        el.eventListenerList[type].splice(0,0,f);
    } else {
        el.eventListenerList[type].push(f);
    }
    
    if(!el['on'+type]){
        el['on'+type] = function(e){
            for(var i in el.eventListenerList[type]){
                el.eventListenerList[type][i](e);
            }
        };
    }
};

EVENT.removeListener = function(el, f){
    
    if(!el.eventListenerList){
        return;
    }
    
    //note: "var i in obj" is incompatible with icky prototype library
    var list = el.eventListenerList;
    for(var i in list){
        for(var j in list[i]){
            if( list[i][j] == f ){
                //remove it.
                el.eventListenerList[i].splice(j,1);
                return;
            }
        }
    }
    
};

EVENT.hasListener = function(el, f){

    if(!el.eventListenerList){
        return false;
    }
    
    //note: "var i in obj" is incompatible with icky prototype library
    var list = el.eventListenerList;
    for(var i in list){
        for(var j in list[i]){
            if( list[i][j] == f ){
                return true;
            }
        }
    }
    
    return false;
};
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-1164933942545455841?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/1164933942545455841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/09/events.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1164933942545455841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1164933942545455841'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/09/events.html' title='Events'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4195184174718827381</id><published>2008-09-10T11:05:00.000-07:00</published><updated>2009-07-07T15:40:38.204-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='webkit'/><category scheme='http://www.blogger.com/atom/ns#' term='rotated'/><category scheme='http://www.blogger.com/atom/ns#' term='svg'/><category scheme='http://www.blogger.com/atom/ns#' term='ellipse'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><category scheme='http://www.blogger.com/atom/ns#' term='rotate'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='transform'/><title type='text'>svg boundingbox of rotated ellipse</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_m9ULsfy0rG0/SMgOnm8BYdI/AAAAAAAAAeI/QPP8VJ15tnw/s1600-h/ellipse.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_m9ULsfy0rG0/SMgOnm8BYdI/AAAAAAAAAeI/QPP8VJ15tnw/s320/ellipse.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5244457839702925778" /&gt;&lt;/a&gt;

&lt;p&gt;
Found out last night that safari has a bug in its svg implementation (ok, probably lost most of you right there “who cares about svg?” … but there’s a possibility that this could be useful for flash/actionscript too)
&lt;/p&gt;
&lt;p&gt; 
Turns out that if you rotate an ellipse, the getBBox method returns a rather generous bounding box, because it’s using an implicit rectangle wrapped around the ellipse to get the bounding box.
&lt;/p&gt;
&lt;p&gt; 
 
You can see below what the browser bug is and what the correct box is. The red—buggy—implementation is created by the browser basing its calculations on the blue (implicit) rectangle that surrounds the ellipse.
&lt;/p&gt;
&lt;p&gt; 
 
The correct result is the box in green.
&lt;/p&gt;
&lt;p&gt; 
I created a javascript workaround for this bug.
&lt;/p&gt;
&lt;p&gt; 
 
It uses calculus.  This is the first time I’ve used calculus in programming something that didn’t exist solely to demonstrate calculus.
 
&lt;/p&gt;
&lt;p&gt; 
I first tried to find a solution posted somewhere on the net, but only found a post where someone says it’s solved in the latest version, then reverses himself and says, ‘oh, no, actually it’s firefox that fixed its version of the same bug.’
 
&lt;/p&gt;
&lt;p&gt; 
If someone happens to find the bug # or a posted solution, that’d be cool.
&lt;/p&gt;


&lt;pre class="brush:js;" name="code"&gt;

        // Trig functions (Math shortcut aliases)
        var sin = Math.sin,
            cos = Math.cos,
            tan = Math.tan,
            cot = function(a){return 1/tan(a);},
            sqrt= Math.sqrt,
            acos= Math.acos,
        
        
        // our instance of an ellipse .. will become something more like this._shape (if this.type == ELLIPSE)
            ellipse = $('e').getElementsByTagName('ellipse')[0],
        
        // the properties of our instance of an ellipse
            a = ellipse.getAttribute('rx')*1, //x-radius (major, minor, who knows)
            b = ellipse.getAttribute('ry')*1, //y-radius (major, minor, who cares)
            cx = ellipse.getAttribute('cx')*1, //center's x-coord .. not currently used (assume the ellipse is centered at the origin)
            cy = ellipse.getAttribute('cy')*1, //center's y-coord .. not currently used (assume the ellipse is centered at the origin)
            matrix = ellipse.getCTM(), //the transform matrix
            angle = acos( matrix.a ),
        
        // the x coordinates where the ROTATED xmax and ymax occur on the ellipse BEFORE ROTATION.
        // these "magical" formulas represent the recombined derivative of the ellipse function
            x1 = (-1*(a*a)*tan(angle)) / sqrt(a*a*tan(angle)*tan(angle) + (b*b)),
            x2 = (   (a*a)*cot(angle)) / sqrt(a*a*cot(angle)*cot(angle) + (b*b)),
        
        // the actual xmax and ymax, reflecting the above, rotated into position (AFTER ROTATION).
            xmax = (cos(angle) * x2) + (sin(angle) * f(x2)),
                // (using negative-angle because positive screen y-axis is the same as 'normal maths' negative y-axis)
            ymax = (sin(-angle) * x1) + (cos(-angle) * f(x1));
        //var
        
        // the f(x) that defines the ellipse (in general form)
        function f(x){
            return b * Math.sqrt(1-((x*x)/(a*a)));
        };
        
        //~ console.log(ellipse.getAttribute('transform'));
        //~ log(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
        
        // browser's idea of where the bbox is... (red box)
        var box = ellipse.parentNode.getBBox();
        re = $("re");
        re.setAttribute("x", box.x);
        re.setAttribute("y", box.y);
        re.setAttribute("width", box.width);
        re.setAttribute("height", box.height);
        re.setAttribute("stroke", "red");
        
        // my idea of where the bbox is... (green box)
        re = $("re2");
        re.setAttribute("x", -Math.abs(xmax));
        re.setAttribute("y", -Math.abs(ymax));
        re.setAttribute("width", Math.abs(xmax)*2);
        re.setAttribute("height", Math.abs(ymax)*2);
        re.setAttribute("stroke","#090");

&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4195184174718827381?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4195184174718827381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/09/svg-boundingbox-of-rotated-ellipse.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4195184174718827381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4195184174718827381'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/09/svg-boundingbox-of-rotated-ellipse.html' title='svg boundingbox of rotated ellipse'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_m9ULsfy0rG0/SMgOnm8BYdI/AAAAAAAAAeI/QPP8VJ15tnw/s72-c/ellipse.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-5951896787719464921</id><published>2008-06-09T08:03:00.000-07:00</published><updated>2008-09-10T11:21:27.874-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='ie'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='safari'/><title type='text'>debug</title><content type='html'>&lt;ul&gt;
&lt;li&gt;
FF: Firebug  : https://addons.mozilla.org/en-US/firefox/addon/1843
&lt;/li&gt;
&lt;li&gt;
IE: DebugBar : http://www.debugbar.com/
&lt;/li&gt;
&lt;li&gt;
SF: Developer: http://developer.apple.com/internet/safari/faq.html#anchor14
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Debug in production?! .. when you have to .. you can target a strange userAgent string .. such as "Quality Assurance Browser" .. that you set yourself with some tool that allows you to set your userAgent.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-5951896787719464921?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/5951896787719464921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/debug.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5951896787719464921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/5951896787719464921'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/debug.html' title='debug'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-6228406626188959127</id><published>2008-06-03T09:13:00.001-07:00</published><updated>2009-07-07T15:43:12.599-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='always remove'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='yui compressor'/><title type='text'>YUI Compressor wishlist</title><content type='html'>Ok, so my list is currently composed of only one item: Flag for always remove. YUI Compressor already has a flag to *never* remove /** comments **/ that probably contain copyright information. I'd like it if YUI Compressor had a flag to *always* remove a block of code. Use case: remove debug statements. Perhaps it could be implemented as comments that demarcate the debug block, such as:

&lt;pre name="code" class="brush:js;"&gt;
/** debug **/
console.dir( myObj );
/**/
&lt;/pre&gt;

and a corresponding YUI Compressor command-line argument "-rmdebug"

&lt;pre name="code" class="brush:js;"&gt;
$ java -jar yuicompressor-2.5.2.jar -rmdebug script.js -o script-min.js
&lt;/pre&gt;

&lt;b&gt;Update:&lt;/b&gt; Ok, so.. &lt;i&gt;after&lt;/i&gt; I posted this, I searched the yuicompressor feature request list, and natch, somebody requested this - at least the debug-one-liner version: treat as debug any line that is prefixed with ";;". &lt;a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1919432&amp;group_id=165715&amp;atid=836479"&gt;YUI Compressor Feature Request: remove debug code&lt;/a&gt;.

&lt;pre name="code" class="brush:js;"&gt;
;; console.dir( myObj ); //double-semicolon prefix indicates this line is for debugging
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-6228406626188959127?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/6228406626188959127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/yui-compressor-wishlist.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6228406626188959127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/6228406626188959127'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/yui-compressor-wishlist.html' title='YUI Compressor wishlist'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-1212706882855226406</id><published>2008-06-02T11:32:00.000-07:00</published><updated>2009-07-07T15:44:21.141-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='json'/><title type='text'>Working with JSON</title><content type='html'>Often, on a callback that receives json, you may be tempted to do something such as:

&lt;pre class="brush:js;" name="code"&gt;
if (data.image.length) {
    // Group of images
    for (var i = 0; i &lt; data.image.length; i++) {
        debug("Image " + data.image[i].imageUrl + ": " + data.image[i].statusText);
    }
}
else {
    // Just a single image
    debug("Image " + data.image.imageUrl + ": " + data.image.statusText);
}
&lt;/pre&gt;

but it can be expressed more succinctly as:

&lt;pre class="brush:js;" name="code"&gt;
if (!data.image.length) data.image = [data.image];
// Group of images
for (var i = 0; i &lt; data.image.length; i++) {
    debug("Image " + data.image[i].imageUrl + ": " + data.image[i].statusText);
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-1212706882855226406?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/1212706882855226406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/working-with-json.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1212706882855226406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1212706882855226406'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/06/working-with-json.html' title='Working with JSON'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-2411386378028334058</id><published>2008-05-27T13:43:00.000-07:00</published><updated>2009-07-07T15:45:07.181-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='xml to json'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='json'/><title type='text'>Super Simple XML-String to JSON</title><content type='html'>Yes, there are other libraries for this. Yes, they are more complete. So why this? I didn't need all the features of a &lt;span style="font-style:italic;"&gt;complete&lt;/span&gt; xml-&gt;json map, I just wanted something to handle my nice, super simple use-case. And I hate wasted bandwidth. This library is 620 BYTES when YUI-compressed.&lt;br /&gt;
&lt;br /&gt;
This is for a specific task. I trust the xml source. (So nobody yell "hey! - you're using eval() - you're eveel!").&lt;br /&gt;
&lt;br /&gt;
Prerequisites:&lt;ul&gt;&lt;li&gt;you have a string of well-formed xml.&lt;/li&gt;&lt;li&gt;you don't have &amp; don't care about node attributes, namespaces or CDATA (ie. your XML is 'Super Simple').&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
Good Ideas:&lt;ul&gt;&lt;li&gt;Don't use a library that will dirty the object prototype.&lt;br /&gt;(ie. mess up for-loops that look like this: for(var prop in obj){..})&lt;/li&gt;&lt;li&gt;Strip comments and whitespace, use safe variable-name substitution&amp;#8212;use YUI Compressor.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
Confessions:&lt;ul&gt;&lt;li&gt;It uses eval().&lt;/li&gt;&lt;li&gt;It uses regular-expressions (regexes).&lt;/li&gt;&lt;li&gt;It could probably stand to be optimized a bit.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
The Code:
&lt;pre name="code" class="brush:js;"&gt;
var xmlString = "&amp;lt;root&amp;gt;&amp;lt;a/&amp;gt;&amp;lt;b&amp;gt;data1&amp;lt;/b&amp;gt;&amp;lt;b&amp;gt;data2&amp;lt;/b&amp;gt;&amp;lt;/root&amp;gt;";
function xmlString2json (xmlString) {
    return xmlString.replace(
            //expand empty tags
            /\&amp;lt;([^&amp;gt;]*)\/\&amp;gt;/g, "&amp;lt;$1&amp;gt;&amp;lt;/$1&amp;gt;"
        ).replace(
            //convert closing tags to closing braces
            /\&amp;lt;\/([^&amp;gt;]*)\&amp;gt;/g,"},"
        ).replace(
            //convert opening tags to "{NODENAME:["
            //notice that the array literal is opened, but not closed.
            /\&amp;lt;([^&amp;gt;]*)\&amp;gt;/g,"{'$1':[" 
        ).replace(
            //remove extraneous commas
            /,}/g,"]}"
        ).replace(
            //close array literal, begin adding needed singlequotes
            /:([^{}]*?)}/g,":'$1]'}"
        ).replace(
            //adjust singlequotes, bring inside array literal notation (left side)
            /'\[/g,"['"
        ).replace(
            //adjust singlequotes, bring inside array literal notation (right side)
            /\]'/g,"']"
        ).replace(
            //remove empty strings (which are from empty tags)
            /\[''\]/g,"[]"
        ).replace(
            //remove final, ending extraneous comma
            /},$/, '}'
    );
}

var json = xmlString2json(xmlString);
// {'root':[{'a':[]},{'b':['data1']},{'b':['data2']}]}

function cleanTree(r, p){
    if(r.length == 1 &amp;&amp; typeof r[0] == "string"){
        //might want to trim leading and trailing whitespace from r[0] first
        // could be expressed as a series of ternary operations:
        // return r[0]=="true"?true:r[0]=="false"?false:r[0].search(/^[0-9]+$/)==0?1*r[0]:r[0]
        // expressed this way for readability:
        if(r[0] == "true"){
            return true;
        }
        if(r[0] == "false"){
            return false;
        }
        if(r[0].search(/^[0-9]+$/) == 0){
            return 1*r[0];
        }
        return r[0];
    }
    p = p || {};
    for( i in r ){
        var nn = '';
        for( name in r[i] ){
            nn = name;
        }
        var subnode = r[i][nn];
        if(p[nn]){
            if(typeof p[nn] == "object" &amp;&amp; typeof p[nn].length == "number"){
                p[nn].push( cleanTree(subnode) );
            } else {
                p[nn] = [ p[nn], cleanTree(subnode) ];
            }
        } else {
            p[nn] = cleanTree(subnode);
        }
    }
    return p;
}

var jso = eval('('+json+')');
var cleaned = cleanTree(jso.testImages);
console.log(cleaned);
&lt;/pre&gt;
&lt;br /&gt;
At this point, you might be wondering, "Why all those [extra] arrays?" My idea was to approximate the concept of the childNodes array. Really, you could just take the initial JSON and run with it, keeping in mind that it is structured with 'childNodes' arrays. But in case you'd rather have it 'cleaned' up .. I made the recursive &lt;span style="font-weight:bold;"&gt;cleanTree&lt;/span&gt; function to do just that.&lt;br /&gt;
&lt;br /&gt;
"What if I have &lt;span style="font-style:italic;"&gt;actual&lt;/span&gt; xml, not just a &lt;span style="font-style:italic;"&gt;string representation&lt;/span&gt; thereof?" you may question.&lt;br /&gt;
&lt;br /&gt;
Give this a shot:
&lt;pre name="code" class="js"&gt;
    var xmlString = (new XMLSerializer()).serializeToString( myXMLDoc );
&lt;/pre&gt;
Someone else's related post (reminder to self to see if his xml2json will work in actionscript / how readily adaptable it is): &lt;a href="http://onwebdevelopment.blogspot.com/2008/05/converting-xml-to-json.html"&gt;converting xml to json&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-2411386378028334058?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/2411386378028334058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/05/super-simple-xml-to-json.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2411386378028334058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/2411386378028334058'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/05/super-simple-xml-to-json.html' title='Super Simple XML-String to JSON'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-1937028528992263041</id><published>2008-04-05T21:21:00.000-07:00</published><updated>2009-07-07T15:45:26.856-07:00</updated><title type='text'>consume that data</title><content type='html'>Have an array that you need to iterate over?

Dying to use javascript 1.8 iterators and generators? (why?!)

Anyhow... use &lt;span style="font-weight:bold;"&gt;this &lt;/span&gt;instead.. IF IF IF ... you don't mind CONSUMING your data :-)

(&lt;span style="font-weight:bold;"&gt;this &lt;/span&gt;= shift)

&lt;pre name="code" class="brush:js;"&gt;
var s=['prototype.yc','lightbox','dsn'];
while(s.length) document.write('&amp;lt;scr'+'ipt src="/js/'+s.shift()+'.js"&amp;gt;&amp;lt;/scr'+'ipt&amp;gt;');
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-1937028528992263041?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/1937028528992263041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/04/consume-that-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1937028528992263041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/1937028528992263041'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/04/consume-that-data.html' title='consume that data'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-854571982213666744</id><published>2008-04-04T10:06:00.000-07:00</published><updated>2009-07-07T15:45:47.839-07:00</updated><title type='text'>directory structure = sitenav = breadcrumbs = CSS</title><content type='html'>Ok?

Example:

&lt;pre name="code" class="brush:html;"&gt;
/
home
home
home

/mainsection
mainsection
home &amp;gt; mainsection
&amp;lt;html class="mainsection"&amp;gt;

/mainsection/subsection
mainsection &amp;gt; subsection
home &amp;gt; mainsection &amp;gt; subsection
&amp;lt;html class="mainsection"&amp;gt;&amp;lt;body class="subsection"&amp;gt;

/mainsection/subsection/leaf
mainsection &amp;gt; subsection &amp;gt; leaf
home &amp;gt; mainsection &amp;gt; subsection &amp;gt; leaf
&amp;lt;html class="mainsection"&amp;gt;&amp;lt;body class="subsection"&amp;gt;&amp;lt;div id="siteContainer" class="leaf"&amp;gt;
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-854571982213666744?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/854571982213666744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/04/directory-structure-sitenav-breadcrumbs.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/854571982213666744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/854571982213666744'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/04/directory-structure-sitenav-breadcrumbs.html' title='directory structure = sitenav = breadcrumbs = CSS'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-8905318813016579929</id><published>2008-03-31T13:52:00.000-07:00</published><updated>2009-07-07T15:46:47.680-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='problem'/><category scheme='http://www.blogger.com/atom/ns#' term='nodes'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='scope'/><category scheme='http://www.blogger.com/atom/ns#' term='for loop'/><category scheme='http://www.blogger.com/atom/ns#' term='error'/><title type='text'>dom nodes + for-loops THAT WORK</title><content type='html'>Imagine you have a collection of DOM nodes (html element nodes, whatever you want to call them) stored in the variable ‘elements’, and that var len = elements.length.

The following for-loop will not work. Every element will have an onclick event handler function that calls clicked(len) – not the respective clicked(i)

&lt;b style="color:red;display:block;padding:4px;border:1px solid #ccc"&gt;WRONG&lt;/b&gt;
&lt;pre name="code" class="brush:js;"&gt;
    for( var i = 0; i &lt; len; i++){
        
        var el = elements[i];
        el.addListener('click', function(){clicked(i);}, false);
        
    }
&lt;/pre&gt;
&lt;b style="color:green;display:block;padding:4px;border:1px solid #ccc"&gt;RIGHT&lt;/b&gt;
&lt;pre name="code" class="brush:js;"&gt;
    (function loop( I ){
        if (I == len) return;
        var i = I;
        
        
        var el = elements[i];
        el.addListener('click', function(){clicked(i);}, false);
        
        
        loop(++I);
    })(0);
&lt;/pre&gt;
Note: addListener is not any browser’s implementation. It’s just my way of saying addEventListener (or, for IE, attachEvent). Also, for brevity, the function ‘clicked’ is not here defined.

Yes, this is documented in a couple places around the web. But those places are not obvious or easily searchable for everyone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-8905318813016579929?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/8905318813016579929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/03/dom-nodes-for-loops-that-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8905318813016579929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/8905318813016579929'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/03/dom-nodes-for-loops-that-work.html' title='dom nodes + for-loops THAT WORK'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-4113242036988896807</id><published>2008-02-26T10:15:00.000-08:00</published><updated>2009-07-07T15:47:22.855-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='conditional'/><category scheme='http://www.blogger.com/atom/ns#' term='short-cut logic'/><title type='text'>If</title><content type='html'>Have you ever seen code like this?
&lt;pre name="code" class="brush:js;"&gt;
if(condition){
&amp;nbsp;&amp;nbsp;&amp;nbsp;stuff
}
&lt;/pre&gt;
This won't work for all cases, but I often enjoy writing it like this:
&lt;pre name="code" class="brush:js;"&gt;
if(!condition) return;
stuff
&lt;/pre&gt;

&lt;b&gt;Note&lt;/b&gt;: if you are NOT minifying your code, the bottom method is probably leaner, but if you ARE minifying, stick with the top method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-4113242036988896807?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/4113242036988896807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/02/if.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4113242036988896807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/4113242036988896807'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/02/if.html' title='If'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4510178934978408169.post-7360139294891002659</id><published>2008-02-26T10:01:00.000-08:00</published><updated>2009-07-07T15:48:01.596-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='prototype'/><title type='text'>Verbosity</title><content type='html'>I ran across some code like this recently:
&lt;pre name="code" class="brush:js;"&gt;
function SomeClass(args){
...
}
SomeClass.prototype.firstMethod = function(args){ ... };
SomeClass.prototype.secondMethod = function(args){ ... };
SomeClass.prototype.thirdMethod = function(args){ ... };
...
...
&lt;/pre&gt;
Maybe, like me, you cringe when you see repetitious code. Maybe not. If not, return.

So I got to thinking of a way to streamline this class.

&lt;pre name="code" class="brush:js;"&gt;
function SomeClass(args){};
SomeClass.prototype = new (function(args){
&amp;nbsp;&amp;nbsp;&amp;nbsp;var me = this;
&amp;nbsp;&amp;nbsp;&amp;nbsp;me.firstMethod = function(args){ ... };
&amp;nbsp;&amp;nbsp;&amp;nbsp;me.secondMethod = function(args){ ... };
&amp;nbsp;&amp;nbsp;&amp;nbsp;me.thirdMethod = function(args){ ... };
&amp;nbsp;&amp;nbsp;&amp;nbsp;...
})();

/* to test it, we'll create an instance and check if it has it's own [copy of] firstMethod */

var myClass = new SomeClass(args);
alert(myClass.hasOwnProperty('firstMethod'));
/* false, it does not have a local copy of the method */
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4510178934978408169-7360139294891002659?l=presentationlayer.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://presentationlayer.blogspot.com/feeds/7360139294891002659/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://presentationlayer.blogspot.com/2008/02/verbosity.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7360139294891002659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4510178934978408169/posts/default/7360139294891002659'/><link rel='alternate' type='text/html' href='http://presentationlayer.blogspot.com/2008/02/verbosity.html' title='Verbosity'/><author><name>Dennis Hall</name><uri>http://www.blogger.com/profile/14606780288611058892</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
