There will soon be a HTML native method to retrieve a device appropriate <img>. It too will repeat the very same environment tests that both our CSS and JS have performed in order to modify their behaviour to the client’s capabilities. And in the case of HTML it will repeat these environment tests for every single <picture> on the page.
This is incredibly inefficient, and has the potential to make hand-authoring web documents implausible. Not to mention the problem that’s really to blame: Our technologies need to sense the environment in unison and adapt to a design, not to a device.
Matt Wilcox: Impending problems with authoring responsive designs
Yesterday, when using Gmail, I started to think about keyboard shortcuts. Specifically, I started to think about how keyboard shortcuts get routed within a modular JavaScript application architecture. If I have a module that can respond to the keyboard – but, that module is not supposed to “know” about the document at large – how does it listen for key-based events? I can think of two ways: 1) Either the application listens for keys and then directly invokes methods on encapsulated modules; or 2) the application listens for keys and then announces key events using an intermediary sandbox. While my gut tells me the former is more effective, I’ve never really used a sandbox bridge; as such, I thought I’d experiment with the latter.
Ben Nadel: Handling Keyboard Shortcuts Within Modular JavaScript Application Architecture
Recently, Apple open sourced the original encoder and decoder for the Apple Lossless audio codec which is written in C/C++. ALAC is, as its name implies, a lossless codec, which means that it is compressed but does not lose any quality. When decoded, ALAC audio files are bit-for-bit identical to the original uncompressed audio file.
When our team at ofmlabs saw ALAC open sourced a few weeks back, we thought it might be fun to try to port it to JavaScript so one could listen to ALAC files in the browser. After all, some of us were also on the team that brought you JSMad, the JavaScript MP3 decoder a few months ago.
Badass JavaScript: Introducing ALAC.js: An Apple Lossless Audio Decoder in JavaScript
I spent a while this week looking into how best to automatically hyphenate text on websites, to improve Today’s Guardian. I couldn’t find anything recent that summarised the options, so here’s a quick run-down of what I discovered.
Phil Gyford: Hyphenation on the web
This article… is a collection of JavaScript’s oddities and well-kept secrets. Some sections will hopefully give you insight into how these curiosities can be useful to your code, while other sections are pure WTF material.
Smashing Magazine: Ten Oddities And Secrets About JavaScript
An ajax loading gif generator, for creating those activity indicators
Ajaxload: Ajax loading gif generator
I’m trying to store the session state in the address bar to allow bookmarking. What can be changed in the URL that won’t trigger a page reload? The hash portion. So what I need to do is add my AJAX application’s parameters after a #.
There is an additional benefit to this approach: When you click on page anchors, these points are added to the browser’s history object so that when you press the back button you’re taken back to these points within the same page. That’s important because items are being added to the history without leaving the current page.
Content with Style: Fixing the Back Button and Enabling Bookmarking for AJAX Apps