克隆时IE8无法识别Html 5时间标记 [英] Html 5 Time Tag not recognized by IE8 when cloning

查看:98
本文介绍了克隆时IE8无法识别Html 5时间标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直无法让IE在此上下文中识别新的Time标记。这一切在FF中都很有效。
以下是代码:

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');

HTML看起来像这样:

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可以找到Time标签,但它返回2个元素的集合。我假设开始和结束。但是,我无法访问它来修改它。我试过val(),html()和text()。我也不能放到实际的HTMLElement。我不能得到(0).innerHTML。但是,如果我.get(0).tagName它实际上是我得到的时间标签。

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.

推荐答案

Delan Azabani关于IE 8是正确的,它支持那些新的HTML5元素。它没有。

Delan Azabani is correct about IE 8 and it's support of those new HTML5 elements. It doesn't.

处理低级支持的好方法是使用这个shiv。

A nice way to handle "down-level" support is to use this shiv.

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

在此处找到: http://code.google.com/p/html5shiv/

它甚至支持在IE< 9中打印,如果需要,这是一个棘手的问题。

It even supports printing in IE<9 which is a sticky issue if you need it.

这篇关于克隆时IE8无法识别Html 5时间标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆