Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#8598 closed bug (worksforme)

$.appendTo() fails for audio tag on IE9

Reported by: nebupookins@… Owned by: nebupookins@…
Priority: low Milestone: 1.next
Component: manipulation Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

Reproducible test case:

<!DOCTYPE HTML>
<html>
<head>
<title>Test</title>
<!--[if lt IE 9]>
<script>
var e = ("abbr,article,aside,audio,canvas,datalist,details," +
  "figure,footer,header,hgroup,mark,menu,meter,nav,output," +
  "progress,section,time,video").split(',');
for (var i = 0; i < e.length; i++) {
   document.createElement(e[i]);
}
</script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
	$('<source src="someOtherFile.mp3">').appendTo($('audio'));
});
</script>
</head>
<body>
<audio controls="true">
	<source src="someFile.mp3">
</audio>
</body>
</html>

Expected behaviour: The <audio> tag should have 2 <source> child elements, one pointing to "someFile.mp3" and one pointing to "someOtherFile.mp3". Firefox and Chrome both exhibit this expected behaviour. IE9 does not.

Actual behaviour: In IE9, the audio tag has only 1 <source> child element.

Additional notes: If you remove the conditional code for IE, you get an error "Unexpected call to method or property access." which is still not the expected behaviour.

Change History (8)

comment:1 Changed 8 years ago by Rick Waldron

Component: unfiledmanipulation
Owner: set to nebupookins@…
Status: newpending

Can you run this test case and confirm that there is only one source elem?

http://jsfiddle.net/rwaldron/J5nPR/1/

comment:3 Changed 8 years ago by nebupookins@…

Status: pendingnew

When I run the test case at http://jsfiddle.net/rwaldron/J5nPR/1/ I get 2 source elements.

comment:4 Changed 8 years ago by timmywil

What about http://jsfiddle.net/timmywil/J5nPR/3/? It may be that the tag wasn't closed. However, that is not a problem in other browsers that support html5 tags.

comment:5 Changed 8 years ago by Rick Waldron

Priority: undecidedlow
Resolution: worksforme
Status: newclosed

Sarcasm doesn't translate well in tickets...

comment:6 Changed 8 years ago by timmywil

I wasn't being sarcastic. I'm asking if $('<source>') is valid versus $('<source/>')

comment:7 Changed 8 years ago by timmywil

Not closing the tag is preferred in html5, so people do <input> instead of <input/>. I'm wondering if this should be supported if it is not already.

comment:8 Changed 8 years ago by timmywil

Oh, you were referring to yourself. :) And apparently it is supported. Adding attributes forces the use of innerhtml, which ie9 may or may not support correctly. <o></o>

Note: See TracTickets for help on using tickets.