Opened 15 years ago
Closed 15 years ago
#1959 closed bug (fixed)
"strings are automatically evaluated" - NOT!
Reported by: | djot | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.2 |
Component: | core | Version: | 1.2.1 |
Keywords: | automatic evalscript | Cc: | |
Blocked by: | Blocking: |
Description
- Hi,
quote from: http://docs.jquery.com/Release:jQuery_1.2 "$(...).evalScripts() This method is no longer necessary in jQuery - all scripts included in HTML strings are automatically evaluated when injected into the document. No substitute method is needed."
if you have this, the click event gets bound (works).
any html/text <span id="foo">bar</span> any html/text $(document).ready(function(){ $("#foo").click(... });
if you do it the other way round, the event does not get bound (does not work):
$(document).ready(function(){ $("#foo").click(... }); any html/text <span id="foo">bar</span> any html/text
I am not sure if this is a feature, for me it's a bug.
djot -
Change History (4)
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This is essentially a duplicate of #1884.
comment:3 Changed 15 years ago by
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
Sorry, on closer examination this actually wasn't a close enough duplicate so I'm reopening it.
comment:4 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Fixed in [4094]. Now all scripts are postponed till after the html is inserted. Unfortunately, $(document).ready() doesn't work with html insertion so at this time it makes sense to postpone all script evaluation since some of them (depending on where they are in the html) have to be postponed anyway. This gives the most consistent results.
forget to mention that my codeblocks shown above are delivered by ajax responses ...