Skip to content

Commit

Permalink
fix custom event fixes for IE8
Browse files Browse the repository at this point in the history
  • Loading branch information
chemerisuk committed Oct 24, 2014
1 parent fe6c772 commit 23a46bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/legacy/forms.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @preserve Form events bubbling fixes for IE8
* @copyright 2013-2014 <%= pkg.author %>
* @copyright 2013-2014 Maksim Chemerisuk
*/
(function() {
var JSCRIPT_VERSION=/*@cc_on @_jscript_version+@*/void 0;
var JSCRIPT_VERSION=/*@cc_on @_jscript_version|@*/void 0;

if (!JSCRIPT_VERSION || JSCRIPT_VERSION > 8) return;

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/inputs.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* @preserve Form elements fixes for IE8-9
* @copyright 2013-2014 <%= pkg.author %>
* @copyright 2013-2014 Maksim Chemerisuk
*/
(function() {
var JSCRIPT_VERSION=/*@cc_on @_jscript_version+@*/void 0;
var JSCRIPT_VERSION=/*@cc_on @_jscript_version|@*/void 0;

if (!JSCRIPT_VERSION || JSCRIPT_VERSION > 9) return;

Expand Down
11 changes: 4 additions & 7 deletions src/util/eventhooks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSCRIPT_VERSION, HTML, DOCUMENT, CUSTOM_EVENT_TYPE } from "../const";
import { JSCRIPT_VERSION, HTML } from "../const";

var hooks = {};
/* istanbul ignore if */
Expand All @@ -9,15 +9,12 @@ if ("onfocusin" in HTML) {
// firefox doesn't support focusin/focusout events
hooks.focus = hooks.blur = (handler) => { handler.capturing = true };
}
/* istanbul ignore else */
if (DOCUMENT.createElement("input").validity) {
hooks.invalid = (handler) => { handler.capturing = true };
}
/* istanbul ignore if */
if (JSCRIPT_VERSION < 9) {
// fix non-bubbling form events for IE8
// fix non-bubbling form events for IE8 therefore
// use custom event type instead of original one
["submit", "change", "reset"].forEach((name) => {
hooks[name] = (handler) => { handler._type = CUSTOM_EVENT_TYPE };
hooks[name] = (handler) => { handler._type = "_" };
});
}

Expand Down

0 comments on commit 23a46bb

Please sign in to comment.