InnerHTML doesn't update element

RESOLVED INVALID

Status

()

Core
DOM: Core & HTML
--
critical
RESOLVED INVALID
11 years ago
11 years ago

People

(Reporter: Ian Dunn, Unassigned)

Tracking

({hang})

1.8 Branch
x86
Windows Server 2003
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

I have a javascript function to go through a table and add up a total based on which days are selected and some other logic. The function is called every time a day is selected or unselected. Every time through it adds up all the elements and updates the subtotal for that row and the total for all rows (the example url has only 1 row).

The problem is that the total only gets updated every other time the function is called. It worked fine when I released it but I noticed now it doesn't work in FF 2.0.0.4 or 1.5.0.11. It works fine in the latest versions of IE and Opera. It doesn't produce any javascript errors. If I open the DOM inspector and go to the 'total' node, then check/uncheck a few boxes, then switch back to the inspector Firefox starts using 99% of the cpu and becomes unresponsive and i have to kill it.

I put alerts on the element innerHTML before and after it's modified and it seems like it does get updated (but the screen doesn't 'refresh' it), but then when it is unchecked it appears to have not been updated.

Reproducible: Always

Steps to Reproduce:
1. Go to http://fightingforalostcause.net/misc/2007/ff-js-innerhtml-bug.html
2. Check and uncheck a few days, you'll notice the subtotal updates every time, but the total only every other time. Also note the values of innerHTML being alert()'d 
3. Open DOM inspector, search to 'total' node
4. Go back to FF, check/uncheck a few boxes
5. When you switch back to DOM inspector it'll be unresponsive and FF will start using 99% of CPU and you'll have you end the process
Actual Results:  
The total node's innerHTML isn't updated, Firefox crashes

Expected Results:  
Total node's innerHTML should be updated

Comment 1

11 years ago
wfm w/ minefield
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a5pre) Gecko/20070530 Minefield/3.0a5pre

please try a build from:
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
Component: General → DOM: Level 0
Product: Firefox → Core
QA Contact: general → general

Updated

11 years ago
Version: unspecified → 1.8 Branch

Comment 2

11 years ago
I don't know why you're expecting sane behavior with your testcase.  document.getElementById's return is undefined if you have multiple elements with the same id!  (Although note that your testcase is "fixed" in Fx 3 development builds.)

That said, we shouldn't be hanging when the DOM Inspector is used.  It's probably worth looking into the cause of that, because the cause might not be branch-only.
Severity: normal → critical
Keywords: hang
(Reporter)

Comment 3

11 years ago
I don't see anywhere that I have multiple elements with the same id. Where are you seeing that?

Comment 4

11 years ago
(In reply to comment #3)
> I don't see anywhere that I have multiple elements with the same id. Where are
> you seeing that?

The table cell and the input you're inserting into "formtotal" both have an id of "total".
(Reporter)

Comment 5

11 years ago
Ah, you're right, I didn't notice that. I change it and it's working now. Sorry for filing the bug report...

Comment 6

11 years ago
-->invalid
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.