IE<9 и .children
Есть объект
<object width="425" height="264"> <param name="movie" value="http://www.youtube.com/v/3OieT8W-9Rs&fs=1&enablejsapi=1&color1=0x666666&color2=0xEFEFEF"> <param name="allowFullScreen" value="true"> <param name="allowscriptaccess" value="always"> <param name="wmode" value="transparent"> <embed src="http://www.youtube.com/v/3OieT8W-9Rs&fs=1&enablejsapi=1&color1=0x666666&color2=0xEFEFEF" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" width="425" height="264"> </object> нужно получить все его параметры $('object, div.youtube-player').each(function () { var $this = $(this); if($this.is('div')){ var width = $this.attr('data-youtube-width') || 288, height = $this.attr('data-youtube-height') || 162; }else{ var width = $this.attr('width') || 288, height = $this.attr('height') || 162; console.log(this.children.length); /*тут IE8 показывает 0, а в других браузерах 5*/ for (var i = 0; i < this.children.length; i++) { console.log(this.children[i]['name']); $this.attr(this.children[i]['name'],this.children[i]['value']); } в чем может быть проблема? спасибо! |
проблема, походу не в js, а в самом IE8. В нем начальный <object> отображается вот так
<OBJECT height="264" width="425"><EMBED width=425 height=264 src=http://www.youtube.com/v/3OieT8W-9Rs&fs=1&enablejsapi=1&color1=0x666666&color2=0xEFEFEF type=application/x-shockwave-flash allowfullscreen="true" allowscriptaccess="always" wmode="transparent"> без <param> но даже так у него должен быть один дочерний элемент <EMBED> |
Часовой пояс GMT +3, время: 05:15. |