Opened 15 years ago
Closed 14 years ago
#1989 closed feature (fixed)
If page loaded with $(sel).load(url) contains Javascript it may not propertly execute
Reported by: | gstolarov | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | ajax | Version: | 1.2.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Since all the nodes loaded with $().load() evaluated in sequence, Javascript elements referring to the following page elements will fail. E.g if following page is loaded using $("#xxx).load(url) it will fail: <script>$("#yyy").click( function() { alert('in here!...'); }); </script> <span id="yyy">click</span>
Where as following page will work: <span id="yyy">click</span> <script>$("#yyy").click( function() { alert('in here!...'); }); </script>
Suggest to evaluate <script/> nodes at after all the elements are processed.
Change History (3)
comment:1 Changed 15 years ago by
Type: | bug → feature |
---|
comment:2 Changed 15 years ago by
Component: | core → ajax |
---|
comment:3 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Now works this way in jQuery 1.3; scripts are executed after all DOM content is inserted.
This is working as expected. There could be times when you want the script to execute before the dom is inserted. Now, if you are suggesting jQuery add a function that would allow scripts to be in the html before the DOM and be executed after I could see that (similar to $(document).ready() does on startup).
I'm going to guess that is what you want and set this ticket to new feature. I'm not sure what it would take to create it but I like the idea.