Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle some quirks mode issues #123

Merged
merged 2 commits into from
Aug 24, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ var Raven = {
function triggerEvent(eventType, options) {
var event, key;

eventType = 'raven' + eventType[0].toUpperCase() + eventType.substr(1);
eventType = 'raven' + eventType.substr(0,1).toUpperCase() + eventType.substr(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, substring(0, 1) is generally a tiny bit faster.


if (document.createEvent) {
event = document.createEvent('HTMLEvents');
Expand All @@ -254,9 +254,14 @@ function triggerEvent(eventType, options) {
}

if (document.createEvent) {
// IE9 if standards
document.dispatchEvent(event);
} else {
document.fireEvent('on' + event.eventType.toLowerCase(), event);
// IE8 regardless of Quirks or Standards
// IE9 if quirks
try {
document.fireEvent('on' + event.eventType.toLowerCase(), event);
} catch(e) {}
}
}

Expand Down