Skip to content

Commit

Permalink
Adding the noJQueryEvents option as a way to avoid using jquery event…
Browse files Browse the repository at this point in the history
…ing in knockout.
  • Loading branch information
dzearing committed Apr 16, 2015
1 parent 1dbe749 commit 1697f55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// For any options that may affect various areas of Knockout and aren't directly associated with data binding.
ko.options = {
'deferUpdates': false
'deferUpdates': false,
'noJQueryEvents': false
};

//ko.exportSymbol('options', ko.options); // 'options' isn't minified
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ ko.utils = (function () {
var wrappedHandler = ko.utils.catchFunctionErrors(handler);

var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType];
if (!mustUseAttachEvent && jQueryInstance) {
if (!ko.options['noJQueryEvents'] && !mustUseAttachEvent && jQueryInstance) {
jQueryInstance(element)['bind'](eventType, wrappedHandler);
} else if (!mustUseAttachEvent && typeof element.addEventListener == "function")
element.addEventListener(eventType, wrappedHandler, false);
Expand Down

0 comments on commit 1697f55

Please sign in to comment.