Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#9373 closed bug (wontfix)

domManip (append/prepend/etc.) RE-evaluates contained scripts

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:


Using append (or another method implemented with domManip) to reposition an in-document element causes its scripts to be re-evaluated.

This is so because domManip passes all contained script elements to evalScript, which evaluates their code and removes the elements. I think it should skip evalScript for elements that are not disconnected or are otherwise known to have already been evaluated.

Change History (4)

comment:2 Changed 12 years ago by Rick Waldron

Component: unfiledmanipulation
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

This is intended behaviour, if you don't need your scripts re-evaluted then i'd recommend separating your presentation from your logic.

comment:3 Changed 11 years ago by [email protected]

If re-evaluation is intended, then why does evalScript remove elements from the DOM?

Also, why is this behavior not documented on the relevant Manipulation pages?

comment:4 Changed 11 years ago by [email protected]

This have been bugging users for quite a few years now, at least a config option to turn on/off auto eval on dommanip would be nice.

Refactoring code to separate concerns , unfourtunately might not be an option in some cases. Im left with having to manually move out all the script tags every time I need a larger DOM manip (on content I cannot change).

Note: See TracTickets for help on using tickets.