New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fadeToggle() with siblings() selector returns the entire script to the DOM #4179

Closed
lechien73 opened this Issue Sep 25, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@lechien73

lechien73 commented Sep 25, 2018

Description

Using fadeToggle() with the siblings() selector returns the text of the entire function on the DOM.

This issue arose in a class where I was teaching jQuery. We reverted to an older version, and the problem goes away. I've replicated the issue in JSFiddle.

In the test case, click on any of the red boxes to see the problem in action. Spurious JavaScript is appended to the DOM.

Link to test case

http://jsfiddle.net/qtpezLyw/

@lechien73 lechien73 changed the title from fadeToggle() returns the entire script to the DOM to fadeToggle() with siblings() selector returns the entire script to the DOM Sep 25, 2018

@TruptiM18

This comment has been minimized.

Show comment
Hide comment
@TruptiM18

TruptiM18 Sep 26, 2018

I am able to recreate a similar problem by using just toggle() instead of fadeToggle().
Link to test case
https://jsfiddle.net/trupti18/jzd3mn0s/6/

TruptiM18 commented Sep 26, 2018

I am able to recreate a similar problem by using just toggle() instead of fadeToggle().
Link to test case
https://jsfiddle.net/trupti18/jzd3mn0s/6/

@lechien73

This comment has been minimized.

Show comment
Hide comment
@lechien73

lechien73 Sep 26, 2018

Yes, it seems to be the same with all toggle functions. slideToggle() does the same.
@TruptiM18

lechien73 commented Sep 26, 2018

Yes, it seems to be the same with all toggle functions. slideToggle() does the same.
@TruptiM18

@timmywil timmywil added this to the 3.4.0 milestone Sep 26, 2018

@timmywil timmywil self-assigned this Sep 26, 2018

@timmywil timmywil removed Blocker Bug labels Oct 1, 2018

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Oct 1, 2018

Member

We looked this over in the meeting and noticed that this is indeed working as expected. The appearance of script text can be confusing, but there is in fact a sibling script element in the fiddle (next to the divs). Script elements are not visible by default, obviously, but can be animated like other elements. There are use cases for this, such as in demos or documentation, so it's not something we want to disable.

This particular case can be fixed by adding a selector to siblings.

https://jsfiddle.net/timmywil/jzd3mn0s/7/

Member

timmywil commented Oct 1, 2018

We looked this over in the meeting and noticed that this is indeed working as expected. The appearance of script text can be confusing, but there is in fact a sibling script element in the fiddle (next to the divs). Script elements are not visible by default, obviously, but can be animated like other elements. There are use cases for this, such as in demos or documentation, so it's not something we want to disable.

This particular case can be fixed by adding a selector to siblings.

https://jsfiddle.net/timmywil/jzd3mn0s/7/

@timmywil timmywil closed this Oct 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment