In viewsetup.js, use CustomEvent if available, falling back to document.createEvent