<?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>36423</bug_id>
          
          <creation_ts>2010-03-20 22:45:33 -0700</creation_ts>
          <short_desc>Object.defineProperty cannot be used to set id of Div element, Element/HTMLDivElement prototype</short_desc>
          <delta_ts>2022-05-31 10:29:49 -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>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Major</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>ahmad.saleem792</cc>
    
    <cc>amla70</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>barraclough</cc>
    
    <cc>ggaren</cc>
    
    <cc>john.david.dalton</cc>
    
    <cc>oliver</cc>
    
    <cc>p.jacquemart</cc>
    
    <cc>t.brain</cc>
    
    <cc>wkenjackson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>202269</commentid>
    <comment_count>0</comment_count>
      <attachid>51241</attachid>
    <who name="T. Brains">t.brain</who>
    <bug_when>2010-03-20 22:45:33 -0700</bug_when>
    <thetext>Created attachment 51241
Object.defineProperty cross-browser testcase

In contrast with the implementation in IE8+ and FF3.7, WebKit ignores properties which collide with native properties on DOM prototypes, and throws an error when trying to define any property on a DOM element.

This was tested against WebKit nightly r56152, Mozilla Developer Preview 3.7 alpha 3, Internet Explorer 8 and Internet Explorer Platform Preview 1.9.7745.6019.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>202312</commentid>
    <comment_count>1</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-03-21 13:35:56 -0700</bug_when>
    <thetext>Trying to override the getter on the prototype of an element is somewhat pointless as WebKit does not use getters for DOM properties.  Technically we could make it do so, but that basically means throwing away performance for no good reason.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>202317</commentid>
    <comment_count>2</comment_count>
    <who name="T. Brains">t.brain</who>
    <bug_when>2010-03-21 14:23:58 -0700</bug_when>
    <thetext>That means there&apos;s absolutely no way to override or extend the default get or set behavior of any of the built-in DOM properties, which is very limiting, and like I mentioned contradicts the behavior of other browsers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>202318</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2010-03-21 14:28:16 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; That means there&apos;s absolutely no way to override or extend the default get or
&gt; set behavior of any of the built-in DOM properties, which is very limiting, and
&gt; like I mentioned contradicts the behavior of other browsers.

What is a use case for overriding &quot;id&quot;, etc?  Understand that for you to have this misfeature then the DOM must be slowed down for all other uses.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>444424</commentid>
    <comment_count>4</comment_count>
    <who name="Alfonso Martínez de Lizarrondo">amla70</who>
    <bug_when>2011-07-31 11:34:58 -0700</bug_when>
    <thetext>A use case for overriding a native property is described here: http://alfonsoml.blogspot.com/2009/09/hooking-textareavalue-with-ckeditor.html

By overriding the &quot;value&quot; of a textarea, it&apos;s possible to use CKEditor but at the same time keep using the same scripts on the page that used to work with plain textareas.

Sure, it&apos;s not a ground breaking feature, but it can be nice to have, because based on this feature it could be possible to map even more properties to make the use of existing code integrate automatically with CKEditor.

Currently if anyone uses the provided script they must tell their users that Safari isn&apos;t supported. It can try to be fast, but it doesn&apos;t do the job that it&apos;s expected to do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>576251</commentid>
    <comment_count>5</comment_count>
    <who name="T. Brains">t.brain</who>
    <bug_when>2012-03-12 10:34:15 -0700</bug_when>
    <thetext>Won&apos;t this be fixed now under Bug 49739?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>576279</commentid>
    <comment_count>6</comment_count>
    <who name="Gavin Barraclough">barraclough</who>
    <bug_when>2012-03-12 11:01:13 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Won&apos;t this be fixed now under Bug 49739?

I wasn&apos;t  sure! - assuming that &apos;id&apos; should be further up the prototype chain than the Element prototype, then I guess so.  Since this bug was about more than just direct properties on instances I was conservative &amp; decided not to dupe, but I think you&apos;re probably right, it probably is just the same issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>636564</commentid>
    <comment_count>7</comment_count>
    <who name="Ken Jackson">wkenjackson</who>
    <bug_when>2012-05-29 16:53:00 -0700</bug_when>
    <thetext>I&apos;ve had similar problems in trying to define a getter for the &apos;src&apos; attribute of DOM img elements without using prototypes.  Many DOM elements have property descriptors where configurable is set to false in webkit/JSC.

Note that in Safari 5.1.6, the 3rd test from comment #1:

&gt; // Override the property on a DIV element
&gt; // PASS: IE8, IE9, FF3.7
&gt; // FAIL: WebKit
&gt; try {
&gt;    Object.defineProperty(el,&quot;id&quot;,{ get:function () { return &quot;c&quot;; } });
&gt;    alert(el.id===&quot;c&quot; ? &quot;PASS&quot; : &quot;FAIL&quot;);
&gt; } catch (e) {
&gt;    alert(&quot;ERROR: &quot;+e.message);
&gt; }

fails and displays an alert &quot;ERROR: Attempting to change access mechanism for an unconfigurable property&quot; and this test does not use the prototype chain.

This test passes in IE8, IE9, FF3.7 and Chrome 19.0.1084.52.

Object.getOwnPropertyDescriptor(el, &apos;id&apos;).configurable returns false in Safari 5.1.6 for this test but returns true in other browsers.   It would be nice if webkit/JSC behaved in a manner that was consistent with other browsers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1872827</commentid>
    <comment_count>8</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-05-30 15:01:09 -0700</bug_when>
    <thetext>I just tried the attached test case with Safari 15.5 and it shows &quot;Pass&quot; for all sub-test cases (four times dialog popped-up) similar to other browsers like Firefox Nightly 102 and Chrome Canary 104. Should this be marked as &quot;Resolved Fixed&quot; or &quot;Resolved Invalid&quot;. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1873034</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-05-31 10:29:41 -0700</bug_when>
    <thetext>Thank you for checking!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>51241</attachid>
            <date>2010-03-20 22:45:33 -0700</date>
            <delta_ts>2010-03-20 22:45:33 -0700</delta_ts>
            <desc>Object.defineProperty cross-browser testcase</desc>
            <filename>defineProperty.html</filename>
            <type>text/html</type>
            <size>1317</size>
            <attacher name="T. Brains">t.brain</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEvL0VOIiAiaHR0cDov
L3d3dy53My5vcmcvVFIvaHRtbDQvc3RyaWN0LmR0ZCI+DQo8aHRtbD4NCjxoZWFkPg0KPHNjcmlw
dCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPg0KdmFyIGVsPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQo
ImRpdiIpOw0KDQovLyBPdmVycmlkZSB0aGUgcHJvcGVydHkgb24gdGhlIEVsZW1lbnQgcHJvdG90
eXBlDQovLyBQQVNTOiBJRTgsIElFOQ0KLy8gRkFJTDogV2ViS2l0LCBGRjMuNw0KdHJ5IHsNCglP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