Side navigation
#6975 closed bug (worksforme)
Opened August 31, 2010 09:20PM UTC
Closed September 02, 2010 01:49AM UTC
Last modified September 03, 2010 11:05AM UTC
$(document).ready() is called a 2nd time after calling nextUntil in combination wrap
Reported by: | lmeurs | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.2 | |
Component: | event | Version: | 1.4.2 |
Keywords: | document ready head body nextUntill wrap | Cc: | |
Blocked by: | Blocking: |
Description
When $(document).ready() is defined in the body, it's is called a 2nd time after nextUntil() is used in combination with wrap() or wrapAll().
When $(document).ready() is defined in the head or nextUntill() or wrap() is not used, $(document).ready() is only called once.
Take the attachment for example: in the beginning of the script one can choose to:
- use $(document).ready(documentReady) or window.onload=documentReady
- set $(document).ready(documentReady) or window.onload=documentReady in head or in body element
When you change either one of these variables, the script behaves as expected.
Tested in all major updated browsers.
Attachments (1)
Change History (2)
Changed September 02, 2010 01:49AM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
Changed September 03, 2010 11:05AM UTC by comment:2
Oh man, sorry for the inconvenience! Your explanation makes sense, I always seem to forget a script-element is an actual HTML-element. Thanks for the effort, appreciate it!
Damn, you had me going there for a moment.
There are two <h1> elements in your document, so this line:
Selects both h1 elements and all the elements up until the next h1. That is basically the entire body! Since that includes the script in the body, the script is executed again in the process of wrapping the second h1 and its following content.
Whether
should re-execute script content that it wraps is another bug (I don't think it should and several related bugs are already open in the ajax component), but in the presence of that bug this code is working as intended.