RESOLVED INVALID 22481
Please consider supporting "document.myForm" access to elements by name in XHTML
https://bugs.webkit.org/show_bug.cgi?id=22481
Summary Please consider supporting "document.myForm" access to elements by name in XHTML
Raghu
Reported 2008-11-25 01:30:17 PST
Accessing the form elements through "document.myform-id" doesn't work in XHTML files. But if i try the same mechanism, in HTML file, it works fine. Since I am using XHTML 1.0 transitional, it should work with XHTML file as well. In XHTML content, the JSCore throws TypeError, saying "document.myform-id" is undefined. I have tested this on Safari with latest nightly and Webkit/Gtk+ with latest nightly. [Note: The JS engine in Chrome supports this way of accessing forms.] See the test page below: --------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/> <title>Form access </title> </head> <body style="background-color:white;border-left:0px;border-top:0px;overflow:hidden;" > <form id="myform" method="POST" action="about:blank"> <input type="hidden" id="name" value=""></input> </form> <script type="text/javascript"> document.myform.name.value="test"; document.myform.setAttribute("action","about:blank"); document.myform.submit(); </script> </body> </html> ----------------------------------------------------------
Attachments
Alexey Proskuryakov
Comment 1 2008-11-25 06:16:48 PST
Who on Chromium team would know whether this behavior is intentional in Chrome, or just a bug?
Raghu
Comment 2 2008-11-25 07:53:14 PST
ap, I am sorry .. I just checked in Chrome .. It doesn't work.. It throws same TypeError. But the same page, when served as HTML works fine in webkit. Isn't it required to behave same as in HTML?. Coz., the XHTML that I am using is 1.0 transitional. (In reply to comment #1) > Who on Chromium team would know whether this behavior is intentional in Chrome, > or just a bug? >
Alexey Proskuryakov
Comment 3 2008-11-25 08:44:36 PST
Are sure sure this works anywhere? Your example in bug 22378 used name, not id.
Raghu
Comment 4 2008-11-25 22:46:08 PST
Right.. using 'name' works , Not by ID. (In reply to comment #3) > Are sure sure this works anywhere? Your example in bug 22378 used name, not id.
Alexey Proskuryakov
Comment 5 2011-09-15 11:30:51 PDT
Per discussion above, it doesn't appear that there is any bug or inconsistency. Safari, Chrome and Firefox behave the same on the above test case, whether it's served as HTML or as XHTML.
Note You need to log in before you can comment on or make changes to this bug.