<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>26127</bug_id>
          
          <creation_ts>2009-06-01 20:08:46 -0700</creation_ts>
          <short_desc>__defineSetter__/__defineGetter__ is ignored on native properties</short_desc>
          <delta_ts>2009-06-04 04:10:37 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>12721</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="T. Brains">t.brain</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>123918</commentid>
    <comment_count>0</comment_count>
    <who name="T. Brains">t.brain</who>
    <bug_when>2009-06-01 20:08:46 -0700</bug_when>
    <thetext>When trying to attach a getter/setter to a native DOM property on an element, the getter/setter seems to be ignored and is never called. The original behavior is maintained.

Use this simple code testcase:

&lt;div id=&quot;d&quot;&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var o=document.getElementById(&quot;d&quot;);

o.__defineSetter__(&quot;id&quot;,function () { alert(&quot;SET&quot;); });

o.id=&quot;test&quot;;
&lt;/script&gt;

Expected behavior: an alert saying &quot;SET&quot;.
Actual behavior: nothing.

The same code works as expected in Firefox and Chrome.

Similarly, attaching the getter/setter on the prototype (for example, on HTMLDivElement.prototype) fails on Safari and Chrome as well, but works as expected in Firefox.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123924</commentid>
    <comment_count>1</comment_count>
    <who name="T. Brains">t.brain</who>
    <bug_when>2009-06-01 20:34:06 -0700</bug_when>
    <thetext>It&apos;s worth noting that this testcase also works as expected in Opera, and the same functionality can be achieved in IE8 using their getter/setter syntax:

Object.defineProperty(o, &quot;id&quot;, { set: function () { alert(&quot;SET&quot;); } });

/* or */

Object.defineProperty(HTMLDivElement.prototype, &quot;id&quot;, { set: function () { alert(&quot;SET&quot;); } });</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124286</commentid>
    <comment_count>2</comment_count>
      <attachid>30941</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-06-04 04:07:26 -0700</bug_when>
    <thetext>Created attachment 30941
test case

Same test, as an attachment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124288</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-06-04 04:10:37 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 12721 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>30941</attachid>
            <date>2009-06-04 04:07:26 -0700</date>
            <delta_ts>2009-06-04 04:07:26 -0700</delta_ts>
            <desc>test case</desc>
            <filename>getter-setter.html</filename>
            <type>text/html</type>
            <size>183</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">PGJvZHk+CjxkaXYgaWQ9ImQiPjwvZGl2Pgo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+
CnZhciBvPWRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkIik7CgpvLl9fZGVmaW5lU2V0dGVyX18o
ImlkIixmdW5jdGlvbiAoKSB7IGFsZXJ0KCJTRVQiKTsgfSk7CgpvLmlkPSJ0ZXN0IjsKPC9zY3Jp
cHQ+CjwvYm9keT4K
</data>

          </attachment>
      

    </bug>

</bugzilla>