Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.
Summary
The __lookupSetter__
method returns the function bound as a setter to the specified property.
Syntax
obj.__lookupSetter__(sprop)
Parameters
-
sprop
- A string containing the name of the property whose setter should be returned.
Description
If a setter has been defined for an object's property, it was not possible to reference the setter function through that property, because that property refers to the return value of that function. __lookupSetter__
can be used to obtain a reference to the setter function.
It is now possible to do this in a standardized way using Object.getOwnPropertyDescriptor()
.
Examples
var obj = { set foo(value) { return this.bar = value; } }; obj.__lookupSetter__("foo") // (function (value) {return this.bar = value;})
Specifications
Not part of any specifications.
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | ? | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | ? | ? | (Yes) |