原型选择器问题 IE 8
我有一个使用以下 CSS 选择器的验证类(原型 1.6.1):
$$('*[class*=validate]')
这个想法是我为以“validate”开头的元素提供了各种类名称,即“validate-numeric”或“validate-url”。因此,我想获取 class 属性中带有 validate 一词的任何元素。
它几乎可以在任何其他浏览器中运行,包括 IE 6 和 IE 6。 7. 在 IE 8 中,它似乎没有选择正确的元素。我尝试在 IE 的开发人员工具中进行一些调试,但无论如何,控制台仅输出数组和对象的 {...} 。我有什么遗漏的吗?是的,它是一个 CSS3 选择器,但我认为它仍然在 Prototype 和 6 & 中实现。 7 人都使用过它。
I have a validation class that uses the following CSS selector (Prototype 1.6.1):
$('*[class*=validate]')
The idea is I have various class names for elements that start with 'validate', ie 'validate-numeric' or 'validate-url'. So, I'd like to grab any element with the word validate in the class attribute.
It works in just about any other browser, including IE 6 & 7. In IE 8, it doesn't seem to select the proper elements. I tried to do some debugging in IE's developer tools, but the console, in all it's wisdom, only outputs {...} for arrays and objects. Is there something I am missing? Yes, it's a CSS3 selector, but I thought it was still implemented in Prototype and 6 & 7 both worked with it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您仍然没有弄清楚,这里有一个替代方案。对所有元素进行这样的分类:
那么这肯定会在 IE8 中工作:
我猜您正在编写一些用于表单验证的代码,这些是可能发生的错误。我的架构的 CSS 是,
而您的 CSS 架构不是模块化的 - 因此,随着您添加越来越多的错误类型,维护变得困难。
If you still haven't figured out, here's an alternative. Classify all your elements as such:
Then this surely will work in IE8:
I'm guessing you're writing some code for form validation and these are errors that could occur. The CSS for my schema would be
Whereas your CSS schema wouldn't be modular - thus making it hard to maintain as your add more and more error types.