js: input type=image is unfindable via js code afaict

RESOLVED WONTFIX

Status

()

Core
DOM: Core & HTML
RESOLVED WONTFIX
16 years ago
16 years ago

People

(Reporter: kitchen_506, Assigned: jst)

Tracking

Trunk
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
see attatched html file for sample code

basically, if you have an <input type=image ...> you can't find it in either the
form object nor the images array.  How would you find out about it via
javascript?  It's clearly there and usable....why can't JS see it?

this has been a problem since NS 4.x days, but is reproducable under mozilla
20020205 (0.9.8) and embeded gecko via galeon 1.0.3

btw, the submission form helper thing is still broken
(Reporter)

Comment 1

16 years ago
Created attachment 68139 [details]
js test case

added html test case demonstrating issue(s)

Comment 2

16 years ago
Confirming with WinNT trunk build 20020204xx; OS: Linux --> All.
Reassigning to DOM Level 0.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → DOM Level 0
Ever confirmed: true
OS: Linux → All
QA Contact: pschwartau → desale
(Assignee)

Comment 3

16 years ago
This is as designed, IE and 4x work exactly like this, and we can't change this.
Changing this would break existing web pages that rely on this not working,
trust me, we've been there. The <input type=image> is findable in the DOM
through the normal lookup methods like document.getElementById() if you give it
an id, or document.getElementsByName() if you give it a name, or
document.getElementsByTagName('input')...

WONTFIX.
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → WONTFIX
(Reporter)

Comment 4

16 years ago
as a final parting shot for any who come looking for this, the solution I found
that more or less gave me what I wanted was:

function bytagname(f)
{
  str = 'Tag elements:\n'
  iitags = f.getElementsByTagNameNS('*', '*');
  for (i=0; i < iitags.length; i++) 
  {
    if (iitags[i].type)  // crude scan for 'formish' elements
    {
      str += '[' + i + ']: ' + iitags[i].type + ' ' + 
        iitags[i].value + ' ' + iitags[i].src + '\n';
    }
  }
  alert(str);
}

where f is a form element.

Thanks for the tip on the element.getElementBy...() functions
You need to log in before you can comment on or make changes to this bug.