Tip
quick tips can all go here
Friday, March 24th, 2006
Category: JavaScript
, Library
, Tip
Dean Edwards is a smart man, and wasn’t happy with any Base classes out there in various libraries so he wrote his own Base.js. His goals: I want to easily create classes without the MyClass.prototype cruft I want method overloading with intuitive access to the overloaded method (like Java’s super) I want to avoid calling Read the rest…
Thursday, March 9th, 2006
Category: Articles
, JavaScript
, Tip
Patrick Fitzgerald has written up his technique for eliminating redisplay flashes in JavaScript. We all see this problem in various scenarios. Nice semantic HTML comes down before the CSS/JS has styled it. For a split second you see the ugly style before the true style is applied. Your first thought might be “I’ll just add Read the rest…
Friday, February 24th, 2006
Category: CSS
, Tip
David Schontzler came up with a quick and useful bookmarklet, ReCSS. It reloads all the stylesheets pulled in via links by adding a query string argument to the end of the URL. Quite handy for applying CSS tweaks to dynamic apps. Tested in Firefox, IE, and Safari.
Thursday, February 23rd, 2006
Category: HTML
, IE
, Tip
Who needs debuggers and add ons, when you can simply put the following in your IE address bar: PLAIN TEXT JAVASCRIPT: javascript:'<xmp>'+window.document.body.outerHTML+'</xmp>';
Tuesday, February 21st, 2006
Category: JavaScript
, Tip
A random tip here. This snippet allows you to truncate a paragraph, and add a '...' to the end of the truncation. When a user clicks on the '...' it expands out to the full text. Truncate the text to a length of your choosing Do not truncate in the middle of a word (only Read the rest...
Thursday, January 26th, 2006
Category: Ajax
, Tip
We run into quirks around the XHR object on various browsers and such. The naive approaches tend to have workarounds put in them, and you soon realise why frameworks like Dojo have the code they do. To make it work. Marko Samastur wrote about a little quirk, and the magic of status code 0. Have Read the rest...
Monday, January 23rd, 2006
Category: JavaScript
, Tip
Beau Hartshorne has been burnt by a few pixels when getting the position of the users cursor cross browser. I discovered that IE’s clientX and clientY measurements were sometimes a couple pixels out. It turns out this is because IE’s the clientX and clientY measurements start from (2,2) in standards mode, and (0,0) in quirks Read the rest...
Wednesday, January 18th, 2006
Category: Library
, Prototype
, Tip
Those prototype folks love their magic functions don't they :) This time, Sam Stephenson has added some CSS selector magic to the Prototype trunk. Example: Find all elements inside elements with class “summary�, all inside the with id “page� and hide each matched tag: PLAIN TEXT JAVASCRIPT: $$('div#page p.summary img').each(Element.hide); For fun, look Read the rest...
Tuesday, January 17th, 2006
Category: Examples
, JavaScript
, Tip
Dynamic languages are the cool thing du jour. All dynamic languages are not born equal, and JavaScript is one that happens to be weakly typed. This means that you can keep throwing new types at a variable and JavaScript takes it in its stride. You sometimes get into some problems though, and one of the Read the rest...
Thursday, January 12th, 2006
Category: JavaScript
, Tip
At a recent client, we were finding strange behaviour occuring in the JavaScript side of the house. After taking a look, the problem was namespace collisions. A couple of the developers were new to JavaScript, and didn't know about the scoping world. For example, the classic: var foo = "whee"; when placed at the top Read the rest...
Wednesday, January 4th, 2006
Category: CSS
, Tip
I have run into the same issue with three projects in a couple of weeks. The issue is a common one, and it comes out as IE not listening to your CSS dimensions. For example, take this blog. We commonly attach images to our posts, and what if we post a large image? The rightbars Read the rest...