Skip to content

Commit

Permalink
minor code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ded committed Jun 13, 2011
1 parent a1d73ac commit 1d5c100
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bean.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@
},

remove = function (element, orgEvents, fn) {
var k, type, events,
var k, type, events, i,
isString = typeof(orgEvents) == 'string',
names = isString && orgEvents.replace(namespace, ''),
rm = removeListener,
attached = retrieveEvents(element);
if (isString && /\s/.test(orgEvents)) {
orgEvents = orgEvents.split(' ');
var i = orgEvents.length - 1;
i = orgEvents.length - 1;
while (remove(element, orgEvents[i]) && i--) {}
return element;
}
Expand Down
2 changes: 1 addition & 1 deletion bean.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bean",
"description": "an events api for javascript",
"version": "0.1.8",
"version": "0.1.9",
"homepage": "https://github.com/fat/bean",
"authors": ["Jacob Thornton <@fat>"],
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/bean.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@
},

remove = function (element, orgEvents, fn) {
var k, type, events,
var k, type, events, i,
isString = typeof(orgEvents) == 'string',
names = isString && orgEvents.replace(namespace, ''),
rm = removeListener,
attached = retrieveEvents(element);
if (isString && /\s/.test(orgEvents)) {
orgEvents = orgEvents.split(' ');
var i = orgEvents.length - 1;
i = orgEvents.length - 1;
while (remove(element, orgEvents[i]) && i--) {}
return element;
}
Expand Down
11 changes: 5 additions & 6 deletions src/ender.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,24 @@

cloneEvents: integrate('clone'),

hover: function (enter, leave) {
for (var i = 0, l = this.length; i < l; i++) {
hover: function (enter, leave, i) { // i for internal
for (i = this.length; i--;) {
b.add.call(this, this[i], 'mouseenter', enter);
b.add.call(this, this[i], 'mouseleave', leave);
}
return this;
}
};

var shortcuts = [
var i, shortcuts = [
'blur', 'change', 'click', 'dblclick', 'error', 'focus', 'focusin',
'focusout', 'keydown', 'keypress', 'keyup', 'load', 'mousedown',
'mouseenter', 'mouseleave', 'mouseout', 'mouseover', 'mouseup', 'mousemove',
'resize', 'scroll', 'select', 'submit', 'unload'
];

for (var i = shortcuts.length; i--;) {
var shortcut = shortcuts[i];
methods[shortcut] = integrate('add', shortcut);
for (i = shortcuts.length; i--;) {
methods[shortcuts[i]] = integrate('add', shortcuts[i]);
}

$.ender(methods, true);
Expand Down

0 comments on commit 1d5c100

Please sign in to comment.