Html 5 Time Tag not recognized by IE8 when cloning
Posted
by matsientst
on Stack Overflow
See other posts from Stack Overflow
or by matsientst
Published on 2010-05-08T05:05:49Z
Indexed on
2010/05/08
5:08 UTC
Read the original article
Hit count: 200
I have been having trouble getting IE to recognize the new Time tag in this context. This all works great in FF. Here is the code:
var origComment = $('.articleComment:first div');
if (origComment.length > 0) {
var commentHtml = origComment.clone(true);
commentHtml.find('time').text('today');
var html = '<article class="' + ((side == 'LEFT') ? '' : 'that') + '">' + commentHtml.html() + '</article>';
$(html).insertAfter('.articleComment:last');
The HTML looks something like this:
<article class="articleComment that">
<div id="156" class="parent">
<div class="byline">
<p>Posted <time pubdate="pubdate" datetime="2010-05-07T09:11:08">today</time> by<br/>
<a class="username" href="/u/matt">matt</a>
</p>
<p class="report"><a href="#">Report?</a></p>
</div>
<div class="comment">left</div>
</div>
</article>
IE can find the Time tag but it returns a collection of 2 elements. I assume the beginning and ending. However, I cannot access it to modify it. I have tried val(), html() and text(). I also can't drop to the actual HTMLElement. I can't get(0).innerHTML. But, if I .get(0).tagName it actually is the Time tag I've got.
Any ideas? I hope this makes sense.
© Stack Overflow or respective owner