#9373 closed bug (wontfix)
domManip (append/prepend/etc.) RE-evaluates contained scripts
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | manipulation | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
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
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
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).
Test case: http://jsfiddle.net/zB4nZ/