Side navigation
#6417 closed bug (duplicate)
Opened April 09, 2010 10:41PM UTC
Closed November 05, 2010 02:40AM UTC
Last modified November 05, 2010 02:40AM UTC
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: | nsalyzyn@gmail.com |
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.
Attachments (0)
Change History (5)
Changed April 12, 2010 04:23PM UTC by comment:1
Changed October 29, 2010 04:55PM UTC by comment:2
owner: | → 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.
Changed October 29, 2010 05:00PM UTC by comment:3
keywords: | script tag, append → needsreview, script tag, append |
---|
Changed November 05, 2010 02:40AM UTC by comment:4
keywords: | needsreview, script tag, append → script tag, append |
---|---|
resolution: | → duplicate |
status: | pending → closed |
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.