* Adds the missing property in descriptor * * @param {Object} object An object that stores values * @param {String} prop Name of the property in the object * @param {Object|null} descriptor Descriptor * @return {Object} Returns the generated descriptor
(object, prop, descriptor)
| 712 | * @return {Object} Returns the generated descriptor |
| 713 | */ |
| 714 | function prepareDescriptorsForObject(object, prop, descriptor) { |
| 715 | descriptor = descriptor || {}; |
| 716 | // the default for the object 'location' is the standard object 'window.location' |
| 717 | object = object === locationDescriptors ? windowLocation : object; |
| 718 | // setter for object properties |
| 719 | descriptor.set = (descriptor.set || function(value) { |
| 720 | object[prop] = value; |
| 721 | }); |
| 722 | // getter for object properties |
| 723 | descriptor.get = (descriptor.get || function() { |
| 724 | return object[prop]; |
| 725 | }); |
| 726 | return descriptor; |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * Wrapper for the methods 'addEventListener/attachEvent' in the context of the 'window' |