Bug Tracker

Modify

Ticket #9373 (closed bug: wontfix)

Opened 2 years ago

Last modified 13 months ago

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

Reported by: rgibson@… Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 2 years ago by rgibson@…

comment:2 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to manipulation

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 18 months ago by rgibson@…

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 13 months ago by rudibr@…

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.