Skip to content

Commit

Permalink
Merge pull request #2 from bevacqua/overloading
Browse files Browse the repository at this point in the history
fix operator overloading
  • Loading branch information
bevacqua committed Apr 9, 2015
2 parents 9d7c31a + d6ab5ea commit 4c81f03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bullseye.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ var tailormade = require('./tailormade');

function bullseye (el, target, options) {
var o = options;
var domTarget = target && target.tagName;

if (arguments.length === 2) {
if (domTarget === false && arguments.length === 2) {
o = target;
}

if (domTarget === false) {
target = el;
}
if (!o) { o = {}; }
Expand Down
3 changes: 3 additions & 0 deletions changelog.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.4.1 Raw Meat


# 1.4.0 Raw Meat

- Made `target` an optional argument
Expand Down
11 changes: 10 additions & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ Option | Description
`tracking` | When not `false`, window resize events will update the position for `el`
`autoupdateToCaret` | Set to `false` if you don't want automatic position updates when `caret` is set to `true`

When you call `bullseye(el, target, options?)`, you'll get back a tiny API to interact with the instance.
When you call `bullseye(el, target?, options?)`, you'll get back a tiny API to interact with the instance.

If `target` isn't provided, it'll match `el`. Bullseye supports operator overloading.

```js
bullseye(el)
bullseye(el, options)
bullseye(el, target)
bullseye(el, target, options)
```

### `.refresh()`

Expand Down

0 comments on commit 4c81f03

Please sign in to comment.