Wrapped CustomEvent constructors in try...catch blocks for IE compatibility.