Skip to content

Commit

Permalink
Merge pull request #9 from canjs/remove-can-util
Browse files Browse the repository at this point in the history
Remove can-util as dependency
  • Loading branch information
imaustink authored Sep 28, 2017
2 parents e0596a4 + 4bcd737 commit ed448b7
Show file tree
Hide file tree
Showing 4 changed files with 2,327 additions and 341 deletions.
31 changes: 0 additions & 31 deletions can-event-dom-enter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var unit = require('steal-qunit');
var domEvents = require('can-dom-events');
var oldEvents = require('can-util/dom/events/events');
var definition = require('./can-event-dom-enter');
var compat = require('./compat');

Expand Down Expand Up @@ -52,24 +51,6 @@ var supportsKeyboardEvents = (function () {
}
});

// Fix oldEvent calls to match new syntax
function newifyOldEvents (oldEvents) {
return {
addEventListener: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.addEventListener.apply(target, args);
},
removeEventListener: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.removeEventListener.apply(target, args);
},
dispatch: function (target) {
var args = Array.prototype.slice.call(arguments, 1);
return oldEvents.dispatch.apply(target, args);
},
};
}

var compatWithNew = {
name: 'compat with can-dom-events',
domEvents: domEvents,
Expand All @@ -81,17 +62,6 @@ var compatWithNew = {
}
};

var compatWithOld = {
name: 'compat with can-util/dom/events',
domEvents: newifyOldEvents(oldEvents),
setup: function () {
this.removeEvent = compat(oldEvents);
},
teardown: function () {
this.removeEvent();
}
};

var rawNewDomEvents = {
name: 'plain with can-dom-events',
domEvents: domEvents,
Expand All @@ -104,7 +74,6 @@ var rawNewDomEvents = {
};

var suites = [
compatWithOld,
compatWithNew,
rawNewDomEvents
];
Expand Down
6 changes: 3 additions & 3 deletions can-event-dom-enter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var domData = require('can-util/dom/data/data');
var getCid = require("can-util/js/cid/get-cid");
var domData = require('can-dom-data-state');
var canCid = require("can-cid");

var baseEventType = 'keyup';

Expand All @@ -12,7 +12,7 @@ function isEnterEvent (event) {
}

function getHandlerKey (eventType, handler) {
return eventType + ':' + getCid(handler);
return eventType + ':' + canCid(handler);
}

function associateHandler (target, eventType, handler, otherHandler) {
Expand Down
Loading

0 comments on commit ed448b7

Please sign in to comment.