<?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>3481</bug_id>
          
          <creation_ts>2005-06-12 14:14:32 -0700</creation_ts>
          <short_desc>form elements added via innerHTML are not accessible via xpath style syntax</short_desc>
          <delta_ts>2005-08-19 09:35:15 -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>Forms</component>
          <version>412</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <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>1</everconfirmed>
          <reporter name="Stuart Morgan">stuartmorgan</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>mitz</cc>
    
    <cc>vicki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>11650</commentid>
    <comment_count>0</comment_count>
    <who name="Stuart Morgan">stuartmorgan</who>
    <bug_when>2005-06-12 14:14:32 -0700</bug_when>
    <thetext>* SUMMARY
a new element added to a form by setting innerHTML on an existing form element
is not accessible via document.form_name.newElement 

* STEPS TO REPRODUCE
1. see attached

* RESULTS 
newElement should be accessible

* NOTES
Works in Firefox

Apple Bug: rdar://4031024</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11651</commentid>
    <comment_count>1</comment_count>
      <attachid>2276</attachid>
    <who name="Stuart Morgan">stuartmorgan</who>
    <bug_when>2005-06-12 14:15:00 -0700</bug_when>
    <thetext>Created attachment 2276
Testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11652</commentid>
    <comment_count>2</comment_count>
    <who name="Stuart Morgan">stuartmorgan</who>
    <bug_when>2005-06-12 14:15:50 -0700</bug_when>
    <thetext>3/1/05 6:00 PM Darin Adler:
I think this is because the elements aren&apos;t added to the form&apos;s elements array.
That&apos;s supposed to be done by registerFormElement, which should be called.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11876</commentid>
    <comment_count>3</comment_count>
    <who name="Niels Leenheer (HTML5test)">info</who>
    <bug_when>2005-06-14 05:58:49 -0700</bug_when>
    <thetext>The problem originated from the innerHTML implementation. The innerHTML
implementation creates a document fragment (that does not contain the 
containing form). For each node that is created the constructor tries
to find the form, but fails. So registerFormElement() is indeed not
called.

I&apos;ll investigate if we can reuse a solution from Konqueror, because 
it is not affected by this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11878</commentid>
    <comment_count>4</comment_count>
      <attachid>2329</attachid>
    <who name="Niels Leenheer (HTML5test)">info</who>
    <bug_when>2005-06-14 07:01:52 -0700</bug_when>
    <thetext>Created attachment 2329
Possible solution

This patch modifies the insertedIntoDocument() function to handle
inserting of documentfragments that do not have a dormant form.
The patch looks for the correct form and registers the form element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12084</commentid>
    <comment_count>5</comment_count>
      <attachid>2329</attachid>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2005-06-15 00:48:12 -0700</bug_when>
    <thetext>Comment on attachment 2329
Possible solution

works for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12248</commentid>
    <comment_count>6</comment_count>
      <attachid>2329</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-16 09:54:34 -0700</bug_when>
    <thetext>Comment on attachment 2329
Possible solution

Patch looks fine, aside from a couple minor stylistic issues:

1) We don&apos;t normally mark our local variables const even though I understand
that there is a slight value in doing so to clarify that they can never be
modified.

2) We don&apos;t normally put the * next to the type, although I don&apos;t know if the
coding style document mentions this.

3) I personally prefer the style where the declaration is inside the if for
code like this.

4) We would normally name this &quot;newForm&quot; rather than &quot;newform&quot;, preferring the
&quot;intercap&quot; style to the &quot;smush words together&quot; style.

Anyway, that&apos;s all trivia: r=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12398</commentid>
    <comment_count>7</comment_count>
      <attachid>2418</attachid>
    <who name="Niels Leenheer (HTML5test)">info</who>
    <bug_when>2005-06-17 00:21:03 -0700</bug_when>
    <thetext>Created attachment 2418
Updated patch

Fixed some minor stylistic issues</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12560</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-18 17:47:56 -0700</bug_when>
    <thetext>We also need an automated test for this. I&apos;ll attempt to turn the test case into a layout test, but in the 
future that should be done before reviewing the patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12561</commentid>
    <comment_count>9</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-18 18:01:58 -0700</bug_when>
    <thetext>I can&apos;t reproduce this problem with Safari 2.0 and WebKit-412 with the test case above.

I&apos;m not going to land the patch that fixes this until I can figure out if there&apos;s actually a bug it fixes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12562</commentid>
    <comment_count>10</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-18 18:03:39 -0700</bug_when>
    <thetext>This bug was originally reported in WebKit version 185 -- I believe it has already been fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12563</commentid>
    <comment_count>11</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-06-18 18:13:53 -0700</bug_when>
    <thetext>While the patch looks fine, it fixes a bug that does not exist. The attach function already handles this case 
just fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12794</commentid>
    <comment_count>12</comment_count>
    <who name="">mitz</who>
    <bug_when>2005-06-21 06:09:32 -0700</bug_when>
    <thetext>Testcase (In reply to comment #9)
&gt; I can&apos;t reproduce this problem with Safari 2.0 and WebKit-412 with the test case above.

Me neither (WebKit-412.6), but I can reproduce it with ToT so this may have been (re-)broken very 
recently. In fact, the layout test fast/forms/element-by-name test fails with ToT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16158</commentid>
    <comment_count>13</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2005-08-07 19:25:25 -0700</bug_when>
    <thetext>Hmm, no, I can&apos;t reproduce any problem at all now. This seems fixed on TOT, and the layout test works 
too. If you see a problem in the future, please write a new bug report so we can be clear on what 
specifically is going wrong without any confusing history about how it used to fail a different way in the 
past.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>2276</attachid>
            <date>2005-06-12 14:15:00 -0700</date>
            <delta_ts>2005-06-12 14:15:00 -0700</delta_ts>
            <desc>Testcase</desc>
            <filename>makeandfocus.html</filename>
            <type>text/html</type>
            <size>1811</size>
            <attacher name="Stuart Morgan">stuartmorgan</attacher>
            
              <data encoding="base64">PGh0bWwgbGFuZz0iZW4iPgo8aGVhZD4KCTxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIg
Y29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ij4KCTx0aXRsZT5UZXN0PC90aXRsZT4K
CTxtZXRhIG5hbWU9ImdlbmVyYXRvciIgY29udGVudD0iQkJFZGl0IDguMCI+CgoJPHNjcmlwdCB0
eXBlPSJ0ZXh0L2phdmFzY3JpcHQiIGxhbmd1YWdlPSJqYXZhc2NyaXB0Ij4KCQlmdW5jdGlvbiBk
b0l0KCkgewoJCQl2YXIgbmV3RmxkID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiaW5wdXQiKTsK
CQkJbmV3RmxkLnNldEF0dHJpYnV0ZSgidHlwZSIsICJ0ZXh0Iik7CgkJCW5ld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ZvY3VzOjxici8+IAo8aW5wdXQgdHlwZT0iYnV0dG9u
IiB2YWx1ZT0iY2xpY2sgdG8gY3JlYXRlIGFuZCBzZXQgZm9jdXMiIG9uQ2xpY2s9ImRvSXQoKSI+
IDxkaXYgaWQ9InRhcmdldCI+PC9kaXY+Cjxici8+Mi4gUmVsb2FkIHRoZSBwYWdlLjxiciAvPgo8
YnIvPjMuIENsaWNrIHRoZSBidXR0b24gYmVsb3cgdG8gYWRkIGEgdGV4dCBmaWVsZCB2aWEgaW5u
ZXJIVE1MID0geHh4IGFuZCBzZXQgaXQncyBmb2N1cyBbTk9URTogZm9jdXMgaXNuJ3Qgc2V0XTxi
ci8+CjxpbnB1dCB0eXBlPSJidXR0b24iIHZhbHVlPSJjbGljayB0byBjcmVhdGUgYW5kIHNldCBm
b2N1cyIgb25DbGljaz0iZG9JdEFnYWluKCkiPjxkaXYgaWQ9ImFub3RoZXJUYXJnZXQiPjwvZGl2
Pgo8YnIvPjQuIFVzZSB0aGUgYnV0dG9ucyBiZWxvdyB0byBhY2Nlc3MgdGhlIGVsZW1lbnQgY3Jl
YXRlZCB2aWEgIzM8YnIvPgo8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0ibm93IGNoZWNrIHdp
dGggcGF0aCBzdHlsZSIgb25DbGljaz0iYWxlcnQoZG9jdW1lbnQuYUZvcm0ubXlGbGRJZCkiPiAt
IG5vIHdvcmt5PGJyLz4KPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9Im5vdyBjaGVjayB3aXRo
IGRvbSBjYWxsIiBvbkNsaWNrPSJhbGVydChkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnbXlGbGRJ
ZCcpKSI+IC0gd29ya3k8YnIvPgo8L2Zvcm0+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2329</attachid>
            <date>2005-06-14 07:01:52 -0700</date>
            <delta_ts>2005-06-18 18:14:07 -0700</delta_ts>
            <desc>Possible solution</desc>
            <filename>html_formimpl.cpp.patch</filename>
            <type>text/plain</type>
            <size>692</size>
            <attacher name="Niels Leenheer (HTML5test)">info</attacher>
            
              <data encoding="base64">SW5kZXg6IGtodG1sL2h0bWwvaHRtbF9mb3JtaW1wbC5jcHANCj09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBmaWxl
OiAvY3ZzL3Jvb3QvV2ViQ29yZS9raHRtbC9odG1sL2h0bWxfZm9ybWltcGwuY3BwLHYNCnJldHJp
ZXZpbmcgcmV2aXNpb24gMS4xNjENCmRpZmYgLXUgLXIxLjE2MSBodG1sX2Zvcm1pbXBsLmNwcA0K
LS0tIGh0bWxfZm9ybWltcGwuY3BwCTIwMDUvMDUvMzEgMDU6NDg6NDEJMS4xNjENCisrKyBodG1s
X2Zvcm1pbXBsLmNwcAkyMDA1LzA2LzE0IDEzOjMzOjExDQpAQCAtOTIzLDYgKzkyMywxNCBAQA0K
ICAgICBtX2Rvcm1hbnQgPSBmYWxzZTsNCiAgICANCiAgICAgSFRNTEVsZW1lbnRJbXBsOjppbnNl
cnRlZEludG9Eb2N1bWVudCgpOw0KKw0KKyAgICBpZiAoIW1fZm9ybSkgew0KKyAgICAgICAgSFRN
TEZvcm1FbGVtZW50SW1wbCogY29uc3QgbmV3Zm9ybSA9IGdldEZvcm0oKTsNCisgICAgICAgIGlm
IChuZXdmb3JtKSB7DQorICAgICAgICAgICAgbV9mb3JtID0gbmV3Zm9ybTsNCisgICAgICAgICAg
ICBtX2Zvcm0tPnJlZ2lzdGVyRm9ybUVsZW1lbnQodGhpcyk7DQorICAgICAgICB9DQorICAgIH0N
CiB9DQogDQogdm9pZCBIVE1MR2VuZXJpY0Zvcm1FbGVtZW50SW1wbDo6cmVtb3ZlZEZyb21Eb2N1
bWVudCgpDQo=
</data>
<flag name="review"
          id="27"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2418</attachid>
            <date>2005-06-17 00:21:03 -0700</date>
            <delta_ts>2005-06-18 18:14:27 -0700</delta_ts>
            <desc>Updated patch</desc>
            <filename>html_formimpl.cpp.patch</filename>
            <type>text/plain</type>
            <size>694</size>
            <attacher name="Niels Leenheer (HTML5test)">info</attacher>
            
              <data encoding="base64">SW5kZXg6IGtodG1sL2h0bWwvaHRtbF9mb3JtaW1wbC5jcHANCj09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBmaWxl
OiAvY3ZzL3Jvb3QvV2ViQ29yZS9raHRtbC9odG1sL2h0bWxfZm9ybWltcGwuY3BwLHYNCnJldHJp
ZXZpbmcgcmV2aXNpb24gMS4xNjENCmRpZmYgLXUgLXIxLjE2MSBodG1sX2Zvcm1pbXBsLmNwcA0K
LS0tIGh0bWxfZm9ybWltcGwuY3BwCTIwMDUvMDUvMzEgMDU6NDg6NDEJMS4xNjENCisrKyBodG1s
X2Zvcm1pbXBsLmNwcAkyMDA1LzA2LzE3IDA3OjE5OjAzDQpAQCAtOTIzLDYgKzkyMywxNCBAQA0K
ICAgICBtX2Rvcm1hbnQgPSBmYWxzZTsNCiAgICANCiAgICAgSFRNTEVsZW1lbnRJbXBsOjppbnNl
cnRlZEludG9Eb2N1bWVudCgpOw0KKyAgICANCisgICAgaWYgKCFtX2Zvcm0pIHsNCisgICAgICAg
IEhUTUxGb3JtRWxlbWVudEltcGwgKm5ld0Zvcm0gPSBnZXRGb3JtKCk7DQorICAgICAgICBpZiAo
bmV3Rm9ybSkgew0KKyAgICAgICAgICAgIG1fZm9ybSA9IG5ld0Zvcm07DQorICAgICAgICAgICAg
bV9mb3JtLT5yZWdpc3RlckZvcm1FbGVtZW50KHRoaXMpOw0KKyAgICAgICAgfQ0KKyAgICB9ICAg
IA0KIH0NCiANCiB2b2lkIEhUTUxHZW5lcmljRm9ybUVsZW1lbnRJbXBsOjpyZW1vdmVkRnJvbURv
Y3VtZW50KCkNCg==
</data>
<flag name="review"
          id="32"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>