Latest update (1.5.dfsg+1.5.0.2-0ubuntu2) could break scripting element objects in the global namespace

Bug #42941 reported by Paul van Genderen on 2006-05-04
12
Affects Status Importance Assigned to Milestone
firefox (Ubuntu)
Medium
Mozilla Team

Bug Description

Using getElementById() to get a form element in a <script> after the form, and then using that element in functions defined earlier (before the form) always worked, but after upgrading to 1.5.dfsg+1.5.0.2-0ubuntu2, sometimes it doesn't.

I'm working on a web application that in the past used a quirksmode doctype (not my idea), but now uses a strict doctype. Form elements no longer have a "name" attribute, and cannot be accessed by this name in JavaScript. The application relied heavily on this ability (again not my idea), so I fixed it by giving the forms an identical "id" attribute, and use getElementById to put the form element back into the global namespace. Like so:

<form method="POST" action="something" name="someform" id="someform">
[...]
</form>
[...]
<script>
someform = document.getElementById("someform");
[...]
</script>

Most pages already had a script block at the end, so I just added it on top. The functions in a script block before the form access someform.whatevertheyneed. Event attributes that call them would work just fine as before, until today. It seemed that it would work most of the time, but not always. I've downloaded Mozilla Firefox from www.getfirefox.com and that works fine.

Before anyone mentions, I know there should be no more name attribute on the form, and I know <script> should be <script type="text/javascript">. I'm just writing it as it is.
I can give an address and login, but that's confidential (actually it's just the login, but the uri alone is useless as it would just redirect to the login page). The application uses HTML, CSS and JavaScript (also PDF, common image formats and on the server PHP/MySQL), but function/variable names and such are in dutch (also not my idea). The UI strings are also dutch, but that is being addressed. Language i18n is planned for next week, and all UI strings will then default to english. Internal names stay what they are.

Tessa (unit3) wrote :

Could this issue be causing bug #42795?

John Vivirito (gnomefreak) wrote :

Is this still and issue for you? We are trying to trying sort out the older Mozilla issues and would like to know if this still happens.

Changed in firefox:
status: Unconfirmed → Needs Info
John Vivirito (gnomefreak) wrote :

If this is still a problem can you please attacha web app that we can use to try and reproduce this bug?

Alexander Sack (asac) wrote :

We close the bug for now, because you have not confirmed that this issue still applies for you. If it still applies, please attach a proper testcase. We can then reopen your bug report.

Changed in firefox:
assignee: nobody → mozillateam
status: Needs Info → Rejected
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers