Opened 11 years ago
Closed 11 years ago
#11359 closed bug (fixed)
.clone() deletes / empties contents of inline SCRIPT tags
Reported by: | nsfmc | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | high | Milestone: | None |
Component: | manipulation | Version: | 1.7.1 |
Keywords: | Cc: | dmethvin | |
Blocked by: | Blocking: |
Description
test case: http://jsfiddle.net/QCp2P/3/
until the .clone() is called, it's possible to query the contents of the script with .html()
The behavior works correctly in ff/safari/chrome, but in IE it seems that the cloning is causing the node to be emptied out even though the script is of type='foo/bar'
i'm not sure if this is related to this: https://github.com/jquery/jquery/blob/master/src/manipulation.js#L592
Change History (7)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → high |
Status: | new → assigned |
This is caused by our use of innerHTML as a better way to clone nodes in older IEs.
I'll patch this tonight
comment:3 follow-up: 4 Changed 11 years ago by
Cc: | dmethvin added |
---|
So, I took a closer look at this and realized that the problem you're having is caused by jQuery only looking for scripts that might be able to execute code when it does any kind of html manipulation with html(), clone() etc.
I can't see a simple or straightforward solution.
comment:4 Changed 11 years ago by
Replying to rwaldron:
So, I took a closer look at this and realized that the problem you're having is caused by jQuery only looking for scripts that might be able to execute code when it does any kind of html manipulation with html(), clone() etc.
I can't see a simple or straightforward solution.
although in my situation, i'm certainly executing the contents of the script tag, this seems like it would be potentially problematic if you were potentially cloning a script tag with type="text/handlebars".
again, i can agree that the use case for that is probably weak, but i'm trying to avoid putting code in divs (which we already do right now, potentially for this very reason).
thanks again for any insight.
comment:7 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
This should have closed when the pull was landed.
#11358 is a duplicate of this ticket.