Dean Edwards explains how the standard “callback” pattern in JavaScript is too brittle for something like a “DOM ready” event. Prototype appears to be the one major library that handles this “correctly.” WIN!
Category: Prototype
Mar24
Jan8
Git has a redesigned homepage that boasts about the major open-source projects that use the up-and-coming DVCS. Prototype is one of them. Thanks, Scott!
Nov16
PDoc: inline documentation for Prototype
As 2008 turns into 2009, it’s past time to dust off some dormant projects in the Prototype realm. I’ve been playing around with PDoc for the first time since April in an effort to get it ready for the next major Prototype release.
Wait — have I not talked about PDoc yet? How is that possible?
OK, …
Nov4
Auto-format Tweets
Used on my “About” page.
(function() {
var USERNAMES = /@([A-Za-z0-9_]*)\b/;
var URLS = /https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?/;
function getInnerText(element) {
element = $(element);
return element.innerText && !window.opera ? element.innerText :
element.innerHTML.stripScripts().unescapeHTML().replace(/[\n\r\s]+/g, ' ');
}
function linkifyTweet(li) {
var html = li.innerHTML, text = getInnerText(li);
text.scan(URLS, function(match) {
html = html.sub(match[0], '<a href="#{0}">#{0}');
});
html = html.gsub(USERNAMES, '<a href="http://twitter.com/#{1}/">#{0}');
li.update(html);
}
function init() {
$('twitter').select('li > span.tweet').each(linkifyTweet);
}
document.observe('dom:loaded', init);
})(); Nov7
Pseudo-custom events in Prototype 1.6
One major goal of frameworks is to minimize the amount of code branching an individual developer has to do. Usually that means the framework does the branching itself, then builds around it an API that will work in all major browsers. By that metric, support for custom events in Prototype 1.6 might be our biggest …
Aug7
The new version of iPhoto, announced not too long ago, features Web Gallery, a way to export your photo library to a .Mac web share. The sample gallery confirms that these Ajax-heavy galleries use Prototype and Scriptaculous under the hood. It could not make me happier that Apple seem to have adopted the two libraries company-wide.
Jun3
Belated note: in case you missed my Refresh Austin talk about Prototype/Scriptaculous, you can experience the slides without having to listen to my stammering commentary.
May1
Prototype 1.5.1 released! If you’re still running 1.5.0, you shouldn’t be. The $$ optimization alone is worth the upgrade.
Apr4
Capabilities vs. Quirks: a look at browser sniffing
Max Carlson (of OpenLaszlo) recently wrote about his toolkit’s approach to browser quirks, reminding me of a great Dev.Opera article on capability detection.
Both argue for an approach that relies on the individual capabilities and quirks of a browser, rather than one that relies on sniffing as a first option. This is a noble idea and …