Export (0) Print
Expand All

2.4.3.1 Object.getOwnPropertyDescriptor (O, P)

  1. This function is not defined for JScript 5.7. It exists only in JScript 5.8.

  2. When the getOwnProperty function is called, the following steps are taken:

  3. If the Type(O) is not Object, raise a TypeError exception.

  4. If the O is not a host object that supports property access using this function, raise a TypeError exception.

  5. Let name be ToString(P)

  6. If O does not have an own property named name, return a new object created as if by evaluating the ECMAScript expressions: {configurable:true,enumerable: true,value: undefined, writable: true}

  7. Let desc be a new object created as by evaluating the expression { }.

  8. If the own property named name of O has the DontEnum attribute, let flag be true; if it does not have the DontEnum attribute, let flag be false.

  9. Call the [[Put]] method of desc passing "enumerable" and flag as arguments.

  10. If the own property named name of O has the DontDelete attribute, let flag be false; if it does not, have the DontEnum attribute let flag be true.

  11. Call the [[Put]] method of desc passing "configurable" and flag as arguments.

  12. If the own property named name of O is an accessor property, go to step 16.

  13. Let value be the current value of the own property named name of O.

  14. Call the [[Put]] method of desc passing "value" and value as arguments.

  15. If the own property named name of O has the ReadOnly attribute, let flag be false; if it does not have the ReadOnly attribute, let flag be true.

  16. Call the [[Put]] method of desc passing "writable" and flag as arguments.

  17. Return desc.

  18. If the own accessor property named name of O has a defined get function, let func be that function object; otherwise, let func be undefined.

  19. Call the [[Put]] method of desc passing "get" and func as arguments.

  20. If the own accessor property named name of O has a defined set function, let func be that function object; otherwise, let func be undefined.

  21. Call the [[Put]] method of desc passing "set" and func as arguments.

  22. Return desc.

Show:
© 2014 Microsoft