Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jan 9, 2012
1 parent c8368c8 commit f721672
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions bean.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
, W3C_MODEL = root[addEvent]
, eventSupport = W3C_MODEL ? addEvent : attachEvent
, slice = Array.prototype.slice
, mouseTypeRegex = /click|mouse|menu|drag|drop/i
, ONE = { one: 1 } // singleton for quick matching making add() do one()

, nativeEvents = (function (hash, events, i) {
Expand Down Expand Up @@ -137,7 +138,7 @@
if (type.indexOf('key') !== -1) {
props = keyProps
result.keyCode = event.which || event.keyCode
} else if ((/click|mouse|menu|drag|drop/i).test(type)) {
} else if (mouseTypeRegex.test(type)) {
props = mouseProps
result.rightClick = event.which === 3 || event.button === 2
result.pos = { x: 0, y: 0 }
Expand Down Expand Up @@ -217,7 +218,7 @@
if (!type || type === '*') {
// search the whole registry
for (var t in map) {
if (t[0] === '$')
if (t.charAt(0) === '$')
forAll(element, t.substr(1), original, handler, fn)
}
} else {
Expand Down Expand Up @@ -269,7 +270,7 @@
, entries = function () {
var t, entries = []
for (t in map) {
if (t[0] === '$')
if (t.charAt(0) === '$')
entries = entries.concat(map[t])
}
return entries
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.4.3",
"version": "0.4.4",
"homepage": "https://github.com/fat/bean",
"authors": ["Jacob Thornton <@fat>", "Dustin Diaz <@ded>", "Rod Vagg <@rvagg>"],
"repository": {
Expand Down
7 changes: 4 additions & 3 deletions src/bean.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
, W3C_MODEL = root[addEvent]
, eventSupport = W3C_MODEL ? addEvent : attachEvent
, slice = Array.prototype.slice
, mouseTypeRegex = /click|mouse|menu|drag|drop/i
, ONE = { one: 1 } // singleton for quick matching making add() do one()

, nativeEvents = (function (hash, events, i) {
Expand Down Expand Up @@ -128,7 +129,7 @@
if (type.indexOf('key') !== -1) {
props = keyProps
result.keyCode = event.which || event.keyCode
} else if ((/click|mouse|menu|drag|drop/i).test(type)) {
} else if (mouseTypeRegex.test(type)) {
props = mouseProps
result.rightClick = event.which === 3 || event.button === 2
result.pos = { x: 0, y: 0 }
Expand Down Expand Up @@ -208,7 +209,7 @@
if (!type || type === '*') {
// search the whole registry
for (var t in map) {
if (t[0] === '$')
if (t.charAt(0) === '$')
forAll(element, t.substr(1), original, handler, fn)
}
} else {
Expand Down Expand Up @@ -260,7 +261,7 @@
, entries = function () {
var t, entries = []
for (t in map) {
if (t[0] === '$')
if (t.charAt(0) === '$')
entries = entries.concat(map[t])
}
return entries
Expand Down

0 comments on commit f721672

Please sign in to comment.