jQuery Mustache 无法在 IE 8 上运行
我已将丑陋的数据解析逻辑转换为 Mustache(对于 http://loop.pk)。非常整洁的东西。我在 Ubuntu/Linux 中进行所有开发,所以我没有注意到,但数据没有显示在 IE 中。
我已经追踪到这一行的错误,“数据”是完美的,填充的并且符合预期。不知道为什么会失败。
$('#template_smslist').mustache(data).prependTo('#tab_inbox');
这是我的模板的外观:
{{#sms}}
<div class="sms_recvd sms_list a">
<div class="sms_list_text">{{text}}</div>
<div class="sms_list_time">{{tstamp}}</div>
</div>
{{/sms}}
这是数据的外观:
{"sms":[{"id":"1727591","text":"Fb shabantoo","tstamp":"1315597361"},{"id":"1727580","text":"Fb and dj shahruk rocking it again","tstamp":"1315597106"},{"id":"1727466","text":"Fb i see unicorns","tstamp":"1315595994"},{"id":"1727214","text":"Fb i see rainbows","tstamp":"1315593322"}.............
请帮忙!
I have converted my ugly data parsing logic to Mustache (for http://loop.pk). Pretty neat stuff. I do all my development in Ubuntu/Linux so I didn't notice but the Data doesn't show up in IE.
I have traced down error to this line, the "data" is perfect, populated and as expected. Don't know why this fails.
$('#template_smslist').mustache(data).prependTo('#tab_inbox');
Here's how my template looks:
{{#sms}}
<div class="sms_recvd sms_list a">
<div class="sms_list_text">{{text}}</div>
<div class="sms_list_time">{{tstamp}}</div>
</div>
{{/sms}}
And here's how data looks like:
{"sms":[{"id":"1727591","text":"Fb shabantoo","tstamp":"1315597361"},{"id":"1727580","text":"Fb and dj shahruk rocking it again","tstamp":"1315597106"},{"id":"1727466","text":"Fb i see unicorns","tstamp":"1315595994"},{"id":"1727214","text":"Fb i see rainbows","tstamp":"1315593322"}.............
Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您的脚本标签中有模板,例如:
看起来您正在使用 https ://github.com/thinkdevcode/jQuery-Mustache 这似乎是这里的问题...
所以,它基本上所做的就是返回,
但在 IE 中,text() 调用什么也不返回。相反,如果使用 html() ,它将在所有浏览器中工作。
所以,我的建议是:
I'm assuming you have the template inside a script tag, something like:
And it looks like you're using https://github.com/thinkdevcode/jQuery-Mustache which appears to be the problem here...
So, all it basically does is to return
but in IE the text() calls returns nothing. Instead if html() was used it would work in all browsers.
So, my suggestion is to just do: