cujojs / poly

Small, fast, awesome. The only ES5-ish set of polyfills (shims) you can mix-and-match because they're individual modules.
Other
139 stars 18 forks source link

Shim Object.getOwnPropertyDecriptor and Object.defineProperty in IE8 #18

Closed mikaelkaron closed 11 years ago

mikaelkaron commented 11 years ago

Note that this does not even try to use a fallback when this is used on a dom element

unscriptable commented 11 years ago

Hey @mikaelkaron,

I was hesitant to add partial support for IE8's dom-only defineProperty functionality since I thought it would confuse devs. However, I've thought of many uses for it lately so I'm definitely interested. :) Thanks for digging in to this!

I think we need a new has() test that is specifically for dom objects ("object-definepropertyfordom" or something even more silly). We could use a function test instead of an existence test like you've done here. We could then sniff for dom nodes inside the Object.defineProperty shim. That seems like it would work.

-- John

normanzb commented 11 years ago

just updated the pull request, @unscriptable would you pls take a look at 3318ef5, we refactored the code and added 'has() check' you mentioned above.

unscriptable commented 11 years ago

This code looks great. Thanks guys! I have a few questions inline...

normanzb commented 11 years ago

updated,

now the 'feature testing' checks both dom object and javascript literal object, return true if the dom object works but javascript literal object fail.

btw, !has('object-defineproperty') should always return false in IE8

unscriptable commented 11 years ago

Thanks @normanzb, I can work with this.

unscriptable commented 11 years ago

Hey @normanzb and @mikaelkaron,

What browser versions are you targeting? We're thinking about dropping support for IE6&7 as well as Firefox 3.6--4 and Safari 5.0.

Feedback appreciated!

-- John

normanzb commented 10 years ago

@unscriptable, sorry i just realise you asked the question 1 year ago, I believe some of @mikaelkaron 's project still need to be compatible with IE7.

Maybe we can move them into a separated file? so for who is interested in older browser support they can pick up the file?