Skip to main content

Bug Tracker

Side navigation

#9373 closed bug (wontfix)

Opened May 21, 2011 02:40AM UTC

Closed May 21, 2011 02:52AM UTC

Last modified May 07, 2012 07:58PM UTC

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

Reported by: rgibson@relware.com 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.

Attachments (0)
Change History (4)

Changed May 21, 2011 02:50AM UTC by rgibson@relware.com comment:1

Changed May 21, 2011 02:52AM UTC by rwaldron comment:2

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.

Changed November 16, 2011 12:02AM UTC by rgibson@relware.com comment:3

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?

Changed May 07, 2012 07:58PM UTC by rudibr@gmail.com comment:4

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).