Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:1 Changed 2 years ago by rwaldron
- Owner set to nebupookins@…
- Status changed from new to pending
- Component changed from unfiled to manipulation
comment:2 Changed 2 years ago by danheberden
http://danheberden.com/share/829b36b.png - 2 of them
comment:3 Changed 2 years ago by nebupookins@…
- Status changed from pending to new
When I run the test case at http://jsfiddle.net/rwaldron/J5nPR/1/ I get 2 source elements.
comment:4 Changed 2 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 2 years ago by rwaldron
- Priority changed from undecided to low
- Status changed from new to closed
- Resolution set to worksforme
Sarcasm doesn't translate well in tickets...
comment:6 Changed 2 years ago by timmywil
I wasn't being sarcastic. I'm asking if $('<source>') is valid versus $('<source/>')
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Can you run this test case and confirm that there is only one source elem?
http://jsfiddle.net/rwaldron/J5nPR/1/