Bug Tracker

Ticket #6391 (closed bug: duplicate)

Opened 5 years ago

Last modified 4 years ago

wrap() bug when wrap javascript

Reported by: Colir Owned by:
Priority: low Milestone: 1.next
Component: manipulation Version: 1.4.2
Keywords: wrap script Cc:
Blocking: Blocked by:

Description

the "wrap()" method re-execute script if the function wrap a div with javascript script

ex: i have javascript in my footer div. if i wrap my main div ( wich contain div header, main and footer), the script in my footer div will be fired twice

Attachments

bug6391.zip Download (24.6 KB) - added by kaaloo 4 years ago.
Simple html page that reproduces this issue

Change History

comment:1 Changed 4 years ago by dmethvin

  • Component changed from unfiled to manipulation

Changed 4 years ago by kaaloo

Simple html page that reproduces this issue

comment:2 Changed 4 years ago by kaaloo

Please review the attached zip file which contains a simple html page that reproduces the issue. It would be great if this got fixed for the next point release.

comment:3 Changed 4 years ago by SlexAxton

  • Keywords wrap script added; wrap() removed
  • Priority set to low
  • Status changed from new to open
  • Milestone changed from 1.4.3 to 1.5

I'm not entirely sure that this is fixable. In order to wrap the elements, they have to be momentarily taken out of the dom, and then placed back in. When you inject a script element into the dom, it executes. Perhaps we could play with finding any script elements and removing them entirely before a wrap inject back into the dom. Another option could be to change it's type attribute to something invalid, as to not force an execution. This may be better since it would keep sibling logic consistent, etc...

For now, for those of you having a problem. Just remove the script tag before you wrap the footer. It doesn't have to live in the dom for the code that was in it to keep working... (unless it hasn't run yet).

comment:4 Changed 4 years ago by jitter

  • Status changed from open to closed
  • Resolution set to duplicate
  • Milestone set to 1.next

comment:5 Changed 4 years ago by jitter

Duplicate of #7040.

comment:6 Changed 4 years ago by jitter

#8259 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.