Closed Bug 649912 Opened 13 years ago Closed 6 years ago

nsContentUtils::BelongsInForm looks very fishy

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86
macOS
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Unassigned)

References

Details

In particular, it looks for things after empty forms.  So this testcase:

  <form name="x"></form>
  <img name="y">
  <script>
    alert(document.forms["x"].y);
  </script>

alerts an element.  I bet that's to deal with the table stuff, but does the spec call for this?  What do other browsers do?  I'd love it if we could nix this PositionIsBefore hackery.
> The spec tells us to look at form.elements.y first

Yes, we do that.  But we also look for things that are not in elements (like <img> inside the form, say).  Do other browsers not do this?  In my testing, they sure seem to.

I guess I'll file a spec bug.
Hmm.  So every browser _except_ IE exposes named <img> inside <form> in form's namegetter.  Is the fact that IE doesn't good enough for us to drop this?

Note that Opera has behavior much like ours, while WebKit exposes the <img> in the form.elements namegetter too.

I guess I'll post to public-html and see what other implementors say.
Priority: -- → P5
This function is long-gone.  It went away in bug 870787, when we made <img> form-associated-ish.
Status: NEW → RESOLVED
Closed: 6 years ago
Depends on: 870787
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.