Closed Bug 514487 Opened 16 years ago Closed 16 years ago

Cloning a document doesn't update the ID map

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

References

Details

Attachments

(3 files)

Attached file testcase
Because cloning doesn't notify, the ID map isn't updated in the cloned doc. Only cloning of XML documents was supported earlier, and for those documents this is regression from bug 344258 (if I read hg blame correctly).
I need to get this fixed.
Assignee: nobody → Olli.Pettay
Ah, hmm. So post-cloning you could walk the DOM and register all the IDs, I guess, right?
Or update the ID map even when not notifying (have to check if that causes some problems).
Yes; unless you remove the updates on notification.
(In reply to comment #4) > Yes; unless you remove the updates on notification. Ofc I'd remove the updates on notification in that case. I was thinking if someone listening ID changes may do something evil.
They won't. In nsIDocument.h: * This fires at difficult times. It is generally not safe to do anything * which could modify the DOM in any way. Use * nsContentUtils::AddScriptRunner.
Depends on: 515080
Attached patch patchSplinter Review
A bit ugly, but this way I don't have care about whether the element has been notified etc. and this shouldn't trigger bug 515080.
Attachment #399120 - Flags: review?(bzbarsky)
Comment on attachment 399120 [details] [diff] [review] patch I suppose this is doable, though I wonder why you need the GetOwnerDoc() call. Take that out and r=me. I don't know what bug 515080 has to do with this, though.
Attachment #399120 - Flags: review?(bzbarsky) → review+
(In reply to comment #8) > I don't know what bug 515080 has to do with this, though. Actually it doesn't have anymore.
No longer depends on: 515080
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: