Ticket #3677 (closed bug: wontfix)
Javascripts re-execute on show/hide
| Reported by: | dmethvin | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.10.0 |
| Component: | ui.effects.core | Version: | 1.6rc2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Referred from http://dev.jquery.com/ticket/3707
If the content being hidden has an embedded script tag, the script is executed a second time. Test case attached using slide effect.
Attachments
Change History
Changed 4 years ago by dmethvin
-
attachment
ui-script-rerun.html
added
comment:1 Changed 4 years ago by dmethvin
This may be due to http://dev.jquery.com/ticket/3105 .
comment:3 Changed 4 years ago by rdworth
- Priority changed from minor to major
- Milestone changed from TBD to 1.6
comment:5 Changed 3 years ago by bencoe
I think is caused by domManip() in association with $.wrap in jquery. When a new element is appended to the dom a stack of scripts to execute is created and evaluated. wrap() uses append() which calls domManip() which re-executes script tags. My thought is that createWrapper() in jquery.effects.core could potentially tear out script tags (these are torn out later on anyways). My assumption being that effects should be executed on visible elements, which means their scripts will already have been executed.
Any ways, here is my potential fix:
http://github.com/bcoe/jquery-ui/commit/58895f118754b1aee823dbfdab3c4442b74c24af
comment:6 Changed 3 years ago by bencoe
This actually provides a better fix in my opinion:
http://github.com/bcoe/jquery-ui/commit/780de910b27d778c0c58e9121c494cd313663a71
it checks to make sure the element has document as its parent before trying to remove the script tag. I think a better ultimate fix would be in the jquery core probably.
comment:7 Changed 3 years ago by bencoe
I've also patched this issue in jQuery... Which might be a more logical place to fix the problem. Basically, wrap() currently causes a script to execute a second time ... note that scripts are already stripped from the page after execution, making this fix less insane than it looks ;)
http://github.com/bcoe/jquery/commit/10169a02d6bc045881097d1b025a474cacf94283
comment:8 Changed 3 years ago by scott.gonzalez
Thanks for the pataches ben. We're trying to figure out how to properly handle this in core. The problem exists with more than just .wrap(). See http://dev.jquery.com/ticket/3105 for the underlying problem.
comment:11 Changed 13 months ago by scott.gonzalez
#8278 is a duplicate of this ticket.
comment:12 Changed 10 months ago by scott.gonzalez
#8460 is a duplicate of this ticket.
comment:14 Changed 7 months ago by mikesherov
- Status changed from open to closed
- Resolution set to wontfix
This will be fixed in core in jquery 1.9 here: http://bugs.jquery.com/ticket/9134


Test case main