Modernizr/Modernizr — Issue #478: Modernizr.prefixed(str,obj) to use Function.prototype.bind?
Author: paulirish
Created: 2012-01-29 19:37:38+00:00
State: open

or just

```js
return function(){ return x.apply(navigator, arguments); }
```

### The reason why

Some recent examples from user tests..

```js
window[ Modernizr.prefixed('requestAnimationFrame', window) ]
battery = nav[ Modernizr.prefixed('battery', nav) ];
window[ Modernizr.prefixed('StorageInfo', window) ];
```

The double window/nav references kinda suck.. wondering if we just automatically bind the scope of it so we can pass back a function.

Hmmm

But would we only do this if the resulting thing is a function? And still just pass back a string otherwise?

how about `Modernizr.prefixed('performance', window);` .. pass back object or string?

Also to consider..

```js
HTMLElement.prototype.webkitMatchesSelector
// so
Modernizr.prefixed('webkitMatchesSelector', HTMLElement.prototype); // return value ??
```

so we should make a call..what do we return?

1. always return a string? (current behavior)
1. return bound function in the case of functions?
1. return actual reference for all cases (`matchesSelector` example disqualifies this)