JavaScript commas in IE

While working with JQuery UI DataTables I got some strange JS errors in IE. And not from any-better-browser.

'style' is null or not an object

My Google cortex provided the answer: IE javascript engine treats array/object initialization different from other engines. While other browsers simply ignores if the initialization has a trailing comma, IE don't. Searching through code to find commas ain't my kind of fun, so the following regular expression will find the instances for you.

,\s*?[\}\]]

I use Derek Slager's better regex tester regularly (pun intended).

Google
m@kli.dk @klinkby RSS feed  GitHub