Wednesday, June 13, 2012

JavaScript split Bugs: Fixed!


The String.prototype.split method is very handy, so it's a shame that if you use a regular expression as its delimiter, the results can be so wildly different cross-browser that odds are you've just introduced bugs into your code (unless you know precisely what kind of data you're working with and are able to avoid the issues). Here's one example of other people venting about the problems. Following are the inconsistencies cross-browser when using regexes with split:
  • Internet Explorer excludes almost all empty values from the resulting array (e.g., when two delimiters appear next to each other in the data, or when a delimiter appears at the start or end of the data). This doesn't make any sense to me, since IE does include empty values when using a string as the delimiter.
  • Internet Explorer and Safari do not splice the values of capturing parentheses into the returned array (this functionality can be useful with simple parsers, etc.)
  • Firefox does not splice undefined values into the returned array as the result of non-participating capturing groups.
  • Internet Explorer, Firefox, and Safari have various additional edge-case bugs where they do not follow the split specification (which is actually quite complex).

Friday, June 8, 2012

Jasmine 1.2 released


Jasmine 1.2 has been available, quietly, for a few weeks now. But consider this the official announcement.
This release is relatively minor, but has a lot of things under the hood that will make it easier for us to continue to improve the project. Some highlights:

Core Fixes & Features

  • New HTML Runner/Reporter (designed by Sean Durham) is now the default
  • An improved toEqual matcher for deep Objects

Gem Fixes & Features

  • Detection and support for the Rails Asset Pipeline
  • All requests served with no-cache headers, helping out when your browser supports them correctly

Development Fixes

  • Catch-up on issues with recent Rubygems and Ruby 1.9.3
  • Fixed bugs when developing for Jasmine on Linux
  • Moved CI to Travis
  • Cleaned up the building/concat of jasmine.js
  • Overall better task code, now tested, for building & testing Jasmine