Tiffany B. Brown

Posts in: JavaScript/ECMAScript

Dispatching Custom DOM Events
Apparently while I wasn’t paying attention, the big four browser vendors (more or less) implemented DOM Level 3 events. And what, exactly, is the big deal about DOM Level 3? Custom DOM events. Custom events are especially important in game development. Let’s say we were developing Pong using JavaScript. We might fire a bounce event […] [12 Oct 2011]
Looping video in browsers that don’t yet support the loop attribute
To date, Firefox does not yet support the loop attribute of the <video> element. This snippet is a simple work-around. Once the video’s ended event is fired, it calls the play method. For more, consult the media events section of the HTML5 specification. [4 Oct 2011]
Introducing HTML5 for AS3 Developers
During my three years at Armchair, I worked on a few ActionScript 3.0 projects. I knew some ActionScript 2.0 when I started, but ActionScript 3.0 was new for me. It is object-oriented and requires event-driven thinking — two skills frankly, that I am still developing. They’re also two skills you should be developing, as they’re […] [3 Oct 2011]
Class manipulation with classList
Many features of JavaScript/DOM frameworks are being incorporated into the browser natively. In my last post, I talked about the Selectors API. In this one, we’ll look at classList. classList makes it much easier to work with elements and class names. With it, you can: Add, remove, and toggle classes; Retrieve the class name at […] [15 Aug 2011]
Meet the Selectors API
DOM Scripting is sometimes clunky. Consider the retrieval of elements with a particular class name. The code might look like this: var p = document.getElementsByTagName(‘p’); var newsitems = []; var i; for(i = 0; i < p.length; i++){ if( p[i].className == ‘newsitem’ ){ newsitems.push( p[i] ); } } In the example above, we’ve retrieved all […] [12 Aug 2011]
Learning JavaScript
Posted for posterity (or at least until these links rot), a list of links and books to get you started. This list isn’t exhaustive by any stretch. Have any other resources to share? Post in the comments. Eloquent JavaScript JavaScript from the Mozilla Developer Center Microsoft’s Scripting Guide for Internet Explorer WebKit DOM Reference Opera […] [7 Apr 2011]
The HTML5 video progress event
UPDATE: Thanks to zcorpan’s comments, I have posted a follow-up entry that should clarify the current status of the video element and its properties. I have been playing around with the HTML5 video interface lately, trying to understand what can be done with it, and how each browser supports its features as set forth in […] [5 Jul 2010]
JavaScript tip: Use a for-loop to reveal properties and methods
I’ve been tinkering with the HTML5 video element quite a bit lately. However, it’s not the best-documented thing in the world. There are very useful properties in the video element’s events that aren’t so clearly explained in the spec. Developing a media player means you have to uncover these properties using a little bit of […] [29 Jun 2010]
Proposed File API specification
Web applications should have the ability to manipulate as wide as possible a range of user input, including files that a user may wish to upload to a remote server or manipulate inside a rich web application. This specification defines the basic representations for files, lists of files, errors raised by access to files, and […] [10 Dec 2009]
A really loose regex for matching URLs
Not recommended for validating URLs, but it will find them. The g flag is JavaScript specific and indicates that the matching should be global. /http:\/\/[\-\.\/\w]{1,256}(|\/)/gi [25 Nov 2009]