Intranet 站点上的 jQuery DataTables - getAttribute('class') 返回 null

发布于 2024-12-18 06:52:48 字数 536 浏览 0 评论 0原文

我正在使用 dataTables 1.8.2 开发一个 Intranet Web 应用程序。

当将浏览器模式加载为 IE9 兼容视图/文档模式 IE7 时,该问题似乎仅在 IE9 中出现。发生这种情况是因为默认情况下,IE9 将此设置应用于 Intranet/本地站点。我不知道为什么。

使用fnSettings().aoData[0].nTr.getAttribute('class')时,返回null。当文档模式设置为IE8标准或更高版本时,它返回正确的类。

有趣的是,如果我尝试使用 getAttribute('id'),则会返回正确的 ID。

当 IE9 处于此兼容模式时,如何获取/设置 aoData 中给定行的类?

我的问题的一个例子是 http://live.datatables.net/iowob (使用 IE9 的 F12 Developer设置 IE9 兼容/IE7 标准的工具)

I am working on an intranet web application using dataTables 1.8.2.

The problem appears to occur only in IE9 when it loads the Browser Mode as IE9 Compat View / Document Mode IE7. This happens because by default, IE9 applies this setup to intranet / local sites. I have no idea why.

When using fnSettings().aoData[0].nTr.getAttribute('class'), null is returned. When Document Mode is set to IE8 standards or above, it returns the correct class.

Interestingly, if I try using getAttribute('id'), the correct ID is returned.

How can I get / set the class of a given row within aoData when IE9 is in this compatibility mode?

An example of my problem is at http://live.datatables.net/ijowob (Use IE9's F12 Developer tools to set IE9 Compat / IE7 Standards)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蝶舞 2024-12-25 06:52:48

这只是 IE7 的错误。检索类名的最可靠方法是使用 elementObj.className DOM 属性。 getAttribute() 只能用于未知属性。

This is just IE7 bug. The most reliable way how to retrieve class name is to use elementObj.className DOM attribute. getAttribute() should be used only with unknown attributes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文