Revision 78130 of Object.prototype.__lookupGetter__()

  • Revision slug: JavaScript/Reference/Global_Objects/Object/lookupGetter
  • Revision title: __lookupGetter__
  • Revision id: 78130
  • Created:
  • Creator: simonzack
  • Is current revision? No
  • Comment 152 words added; page display name reset to default

Revision Content

__lookupGetter__

{{ Non-standard_header() }}

Summary

Return the function bound as a getter to the specified property.

Syntax

obj.__lookupGetter__(sprop)

Parameters

sprop
a string containing the name of the property whose getter should be returned

Description

If a getter has been defined for an object's property, it's not possible to reference the getter function through that property, because that property refers to the return value of that function. __lookupGetter__ can be used to obtain a reference to the getter function.

See also

 

{{ languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Objets_globaux/Object/lookupGetter", "ja": "ja/Core_JavaScript_1.5_Reference/Global_Objects/Object/lookupGetter" } ) }}

Revision Source

<div>
<div id="proxyPrefs" style="top: 75px; left: 75px; position: absolute; display: none;">
<table border="0" cellspacing="0" height="400" style="width: 400px; height: 400px;" width="400"> <tbody> <tr> <td class="borderCornerTL" height="8" id="proxyPrefsNE0" width="8"> </td> <td class="borderEdgeNS" id="proxyPrefsNS0"> </td> <td class="borderCornerTR" height="8" id="proxyPrefsSW0" width="8"> </td> </tr> <tr> <td class="borderEdgeWE" id="proxyPrefsWE0" width="8"> </td> <td class="center" id="proxyPrefsCenter"> <table border="0" style="width: 100%;"> <tbody> <tr> <td><input id="keywords" style="width: 290px;" type="text" value="Keywords:"></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </tbody> </table> <table border="0" style="width: 100%;"> <tbody> <tr> <td align="left" width="50%"><button>Import</button><button>Export</button></td> <td align="center" width="0">|</td> <td align="right" width="50%"><button>Import</button><button>Export</button></td> </tr> </tbody> </table> <table border="0" style="width: 100%;"> <tbody> <tr> <td align="left" width="50%"><button id="actionsPref" style="width: 160px;">Actions</button> <button style="width: 2px;">?</button></td> <td align="left" width="50%"><button style="width: 100%;">Filters</button></td> </tr> <tr> <td align="left" width="50%">   </td> <td align="left" width="50%"> <div id="prefFilters" style="border: 1px solid rgb(170, 170, 170); background-color: rgb(249, 239, 239); width: 100%; height: 280px; color: rgb(255, 255, 255);"> <table border="1" class="prefsTable" id="prefFiltersTable"> <tbody><tr id="prefFiltersTable0" style="width: 100%;"> <td style="overflow: hidden;">&lt;text/&gt;<a style="">[-]</a>&lt;text&gt;a&lt;/text&gt;</td> <td style="overflow: hidden;">&lt;text/&gt;&lt;text&gt;a: element2&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable3" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;  &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;d&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable1" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;  &lt;/text&gt;<a style="">[-]</a>&lt;text&gt;b&lt;/text&gt;</td> <td style="overflow: hidden;">&lt;text/&gt;&lt;text&gt;b: element2&lt;/text&gt;</td> <td style="overflow: hidden;">&lt;text/&gt;&lt;text&gt;b: element3&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable2" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;    &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;i&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable7" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;    &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;h&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable6" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;    &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;g&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable5" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;    &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;f&lt;/text&gt;</td> </tr> <tr id="prefFiltersTable4" style="width: 100%;"> <td style="overflow: hidden;">&lt;text&gt;    &lt;/text&gt;<a style="display: none;">[-]</a>&lt;text&gt;e&lt;/text&gt;</td> </tr> </tbody></table> </div> </td> </tr> </tbody> </table> </td> <td class="borderEdgeWE" id="proxyPrefsWE1" width="8"> </td> </tr> <tr> <td class="borderCornerBL" height="8" id="proxyPrefsNE1" width="8"> </td> <td class="borderEdgeNS" id="proxyPrefsNS1"> </td> <td class="borderCornerBR" height="8" id="proxyPrefsSW1" width="8"> </td> </tr> </tbody>
</table>
</div>
</div>
<h1>__lookupGetter__</h1>
<p>{{ Non-standard_header() }}</p>
<h3 name="Summary">Summary</h3>
<p>Return the function bound as a getter to the specified property.</p>
<h3 name="Syntax">Syntax</h3>
<p><code><em>obj</em>.__lookupGetter__(<em>sprop</em>)</code></p>
<h3 name="Parameters">Parameters</h3>
<dl> <dt><code>sprop</code></dt> <dd>a string containing the name of the property whose getter should be returned</dd>
</dl>
<h3 name="Description">Description</h3>
<p>If a getter has been defined for an object's property, it's not possible to reference the getter function through that property, because that property refers to the return value of that function. <code>__lookupGetter__</code> can be used to obtain a reference to the getter function.</p>
<h3 name="See_also">See also</h3>
<ul> <li><a href="/en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/get_Operator" title="en/Core_JavaScript_1.5_Reference/Operators/Special_Operators/get_Operator">get</a></li> <li><a href="/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/defineGetter" title="en/Core_JavaScript_1.5_Reference/Global_Objects/Object/defineGetter">__defineGetter__</a></li> <li><a class="internal" href="/en/Core_JavaScript_1.5_Reference/Global_Objects/Object/defineSetter" title="en/Core JavaScript 1.5 Reference/Global Objects/Object/defineSetter">__defineSetter__</a></li> <li><a href="/en/Core_JavaScript_1.5_Guide/Creating_New_Objects/Defining_Getters_and_Setters" title="en/Core_JavaScript_1.5_Guide/Creating_New_Objects/Defining_Getters_and_Setters">JS Guide:Defining Getters and Setters</a></li>
</ul>
<p> </p>
<p>{{ languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Objets_globaux/Object/lookupGetter", "ja": "ja/Core_JavaScript_1.5_Reference/Global_Objects/Object/lookupGetter" } ) }}</p>
Revert to this revision