Tuesday, December 21, 2010

Clear options in a MULTI-SELECT field without loops

If I've published anything that qualifies as a "tweet", this post does. Though I have been busy, it has been a while and I sorely miss blogging. With the holidays all around us, small posts make for published posts.

Perhaps I've never had to auto-select OPTION elements in a multi-SELECT field, but I discovered a simple method for doing so, that was worth noting.


Sunday, September 12, 2010

Learning to Open-Source via Proxy

The Internet is a relentless, fast-paced, consumer of content, and I'm a bit of a recluse. My engagements had been brief and trifling; irc chatting, a blog comment here, a forum post there. Then, as a test use of github.com - a popular code-sharing service - I published Proxy. It was my debut in the open-source JavaScript world1, and I was determined to see it through to the end. However, in the reverse time-warp that is the Internet, I've learned that the end never comes...


Friday, August 20, 2010

The smallest boolean in JavaScript

One of my projects has a pretty large API, with lots of methods returning boolean values. At first, I returned 1's and 0's - which are not actual booleans, but are certainly good enough (for most applications). However, for a public API, I knew they would need to return true or false... After making the edits, my file size jumped. Which is how I found the smallest boolean in JavaScript.


Tuesday, August 17, 2010

Proxy - You've come a long way, baby.

I began this post three weeks ago and should have published it then. For it has been an exciting three weeks, for me. I'm proud to announce Proxy, my first opensource JavaScript project, is available on github.com. Alas, this post is only about the journey to that destination...


Friday, July 30, 2010

Use JavaScript comment-urls instead of the traditional void(0) method

The longstanding compromise, between reducing inline JavaScript and preserving accessibility, has been to use "javascript:void(0)" in link hrefs and form-element actions. These elements and attributes are the hardened fall-back to DOM Level 2 events, and (unlike myself) many believe something must be there. Well the ubiquitous technique has a successor that is new to me. I'm no more excited about it's purpose, but glad something new has come along.


Monday, July 26, 2010

Saving to buy things

Remember how your elders would tell you to save in order to save? As in, "this money should never be spent"? Reality check: that's hard to do. Sure, I save money (all I can); I even save to save it. But then I need (ok, want) to buy something, and there goes my savings. That's normal, but the problem is I never spend my money on the reason I'm saving my money.


Friday, July 23, 2010

Inferring node placement via special sourceIndex values

I needed to know whether a node was in the DOM. Figuring there was a native property or method towards this end, I scoured Mozilla's documentation but could find nothing. Then Microsoft (yes, them) offered hope with Internet Explorer's sourceIndex property:
Retrieves the ordinal position of the object, in source order, as the object appears in the document's all collection.


Monday, July 19, 2010

w3c browsers fire bubble listeners before capture listeners

In w3c browsers, the event object's eventPhase property may indicate when it is in capture or bubble mode with a 1 or 3, respectively. A value of 2 indicates that the event object is "at" or processing the target node. However, when the eventPhase is 2, the event's mode is fuzzy.


Wednesday, July 14, 2010

Internet Explorer doesn't bubble click events to the window

This is a simple one. I put some sample code on jsbin.com to show how IE doesn't bubble click events to the window, while w3c browsers do. This is important, because I would normally think to use the window as a "global event listener", not the document. Yeah, I learned this one the hard way.


Debug easier by naming your closures

I was profiling some code when I noticed that several routines were listed as "(?)()" in Firebug, and "JScript anonymous function" in MS's Visual Studio. This proved frustrating, as recognizing my closures were critical to evaluating my code - I couldn't tell which were performing well, let alone executing.


Internet Explorer sanitizes events between nodes

Events are hard in IE. That is just a fact.

I'm not here to gripe about how IE's event object doesn't adhere to standards, nor offers alternatives. Really, I'm not. This is actually a surprising discovery that has less to do with the standard IE/MS diatribe, and more to do with a unique aspect of their event object.


Try, try again

I've failed miserably at blogging before. Blogging had been a confronting exercise, where I had to impress my readers with coherent arguments and razor sharp wit. Perhaps that has always been the problem, in all my writings. There was a time, when I would take hours to write an email. It had all the burden of a delicate surgery - the patient being a relationship.

This time, I plan to write short posts. Indeed, twitter may be the proper forum for my thoughts. I aspire to more, however, I'm alright with doing less. Even now, while at work, I don't have time to write this post. But I need to begin somewhere.