Skip to content

Commit

Permalink
as far as possible using native method if property is not 'prototype'
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimi-GitHub committed Apr 11, 2014
1 parent 8f7a819 commit 51c2cc7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion object.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ define(function (require) {
Object.defineProperty = shims.defineProperty
= has('object-defineproperty-dom')
? useNativeForDom(Object.defineProperty, defineProperty)
: defineProperty;
: has('object-defineproperty-function')
? defineProperty
: definePropertyFunctionPrototype;
}

if (!has('object-isextensible')) {
Expand Down Expand Up @@ -327,6 +329,10 @@ define(function (require) {
object[name] = descriptor && descriptor.value;
return object;
}
function definePropertyFunctionPrototype (fn, name, descriptor) {
fn[name] = name == 'prototype' ? Object.defineProperty.apply(this, arguments) : (descriptor && descriptor.value);
return object;
}

function getOwnPropertyDescriptor (object, name) {
return hasProp(object, name)
Expand Down

0 comments on commit 51c2cc7

Please # to comment.