Closed
Bug 351217
Opened 18 years ago
Closed 18 years ago
getElementById return null for elements overlayed into pref-mailnews.xul
Categories
(SeaMonkey :: Preferences, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: davide.ficano, Assigned: neil)
Details
Attachments
(3 files)
986 bytes,
application/vnd.mozilla.xul+xml
|
Details | |
3.91 KB,
patch
|
bzbarsky
:
review-
bzbarsky
:
superreview-
|
Details | Diff | Splinter Review |
3.02 KB,
patch
|
jst
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060729 SeaMonkey/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060729 SeaMonkey/1.0.4
I added an id-less <vbox> containing a checkbox (with id) child into pref-mailnews.xul. Then I try to obtain the checkbox element using getElementById but it is always null. Adding an onclick event to checkbox that print document.getElementById(this.id)) I obtain always null.
Reproducible: Always
Steps to Reproduce:
1. chrome://messenger/content/pref-mailnews.xul
2. open preferences click on 'Mail & Newsgroup'
3. click on 'Click me' checkbox
Actual Results:
The alert message based on my testcase show
null --- null
The first null refers to a document.getElementById that receive the id as string
The second null refers to document.getElementById(this.id)
this.id is correctly set
Expected Results:
The string indicating the object
Reporter | ||
Comment 1•18 years ago
|
||
Using this file you can reproduce the bug
Assignee | ||
Comment 2•18 years ago
|
||
It looks like that that code path forgets to update the element map.
Assignee: prefs → neil
Status: UNCONFIRMED → ASSIGNED
Attachment #236689 -
Flags: superreview?(bzbarsky)
Attachment #236689 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 3•18 years ago
|
||
Comment on attachment 236689 [details] [diff] [review]
Proposed patch
>+ rv = mDocument->InsertElement(mDocument->mRootContent, mOverlay, notify);
>+ if (NS_FAILED(rv)) return eResolve_Error;
>+
>+ // Add child and any descendants to the element map
>+ rv = mDocument->AddSubtreeToDocument(target);
Whoops, this should be mOverlay of course... Fixed locally.
Comment 4•18 years ago
|
||
Comment on attachment 236689 [details] [diff] [review]
Proposed patch
>Index: nsXULDocument.cpp
> nsXULDocument::OverlayForwardReference::Resolve()
>+ // Add child and any descendants to the element map
>+ rv = mDocument->AddSubtreeToDocument(target);
Won't this call AddSubtreeToDocument twice when |notify| is true?
> rv = mDocument->AddSubtreeToDocument(target);
For reference that looks pretty wrong to me, since it calls AddSubtreeToDocument multiple times on the same node.... Doesn't really affect this patch, except for the |notify| thing.
Attachment #236689 -
Flags: superreview?(bzbarsky)
Attachment #236689 -
Flags: superreview-
Attachment #236689 -
Flags: review?(bzbarsky)
Attachment #236689 -
Flags: review-
Assignee | ||
Comment 5•18 years ago
|
||
Asking jst for review as he was one of the two reviewers who let the double-notify though in the first place and I'm unlikely to get a review from the original author.
Attachment #237106 -
Flags: superreview?(bzbarsky)
Attachment #237106 -
Flags: review?(jst)
Comment 6•18 years ago
|
||
Comment on attachment 237106 [details] [diff] [review]
Fixed notify usage
r=jst, looks right to me.
Attachment #237106 -
Flags: review?(jst) → review+
Comment 7•18 years ago
|
||
Comment on attachment 237106 [details] [diff] [review]
Fixed notify usage
sr=bzbarsky
Attachment #237106 -
Flags: superreview?(bzbarsky) → superreview+
Assignee | ||
Comment 8•18 years ago
|
||
Fix checked in to the trunk.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•