#6417 closed bug (duplicate)
Script tags behave oddly when added to the document
Reported by: | nsalyzyn | Owned by: | nsalyzyn |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.2 |
Component: | manipulation | Version: | 1.4.2 |
Keywords: | script tag, append | Cc: | [email protected]… |
Blocked by: | Blocking: |
Description
The following two jquery calls should have duplicate effects:
$('body') .append( $('<div>some text</div>') .append('<script type="other">something</' + 'script>') ); $('body') .append( ( $('<div>some text</div>') .append('<script type="other">something</' + 'script>') )[0] );
However, it produces the following dom:
<body> <div>some text</div> <script type="other">something</script> <div>some text<script type="other">something</script></div> <body>
The second type of addition makes the most sense. This is important since javascript programs such as MathJax use script tags with other type fields to perform various actions.
Change History (5)
comment:1 Changed 13 years ago by
comment:2 Changed 12 years ago by
Owner: | set to nsalyzyn |
---|---|
Priority: | → undecided |
Status: | new → pending |
Please provide a reduced jsFiddle test case, thanks!
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists.
comment:3 Changed 12 years ago by
Keywords: | needsreview added |
---|
comment:4 Changed 12 years ago by
Keywords: | needsreview removed |
---|---|
Resolution: | → duplicate |
Status: | pending → closed |
Note: See
TracTickets for help on using
tickets.
I found the code responsible:
in jQuery.clean near the bottom of the function there is:
You use ret[i].getElementsByTagName("script"), but do not eliminate those that have blank or text/javascript type fields.