Opened 14 years ago
Closed 11 years ago
#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: | ||
Blocked by: | Blocking: |
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 (3)
Change History (17)
Changed 14 years ago by
Attachment: | ui-script-rerun.html added |
---|
comment:2 Changed 14 years ago by
Component: | ui.core → effects.core |
---|
comment:3 Changed 14 years ago by
Milestone: | TBD → 1.6 |
---|---|
Priority: | minor → major |
comment:4 Changed 14 years ago by
Milestone: | 1.7 → 1.8 |
---|
comment:5 Changed 13 years ago by
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 13 years ago by
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 13 years ago by
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 13 years ago by
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:10 Changed 12 years ago by
Status: | new → open |
---|
comment:13 Changed 11 years ago by
Milestone: | 1.9.0 → 1.10.0 |
---|
comment:14 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | open → closed |
This will be fixed in core in jquery 1.9 here: http://bugs.jquery.com/ticket/9134
Test case main