【问题标题】:Does Prototype.js support custom pseudo-classes?Prototype.js 是否支持自定义伪类?
【发布时间】:2011-12-28 01:43:10
【问题描述】:

也就是说,我可以定义一个名为 :shiny 的选择器并执行此操作吗?

$$('div.shiny') //undesired -- class based
$$('div:shiny') //desired -- logic based

这在 MooTools 和 jQuery 中可用。

【问题讨论】:

  • 如果您非常需要它,只需覆盖 Selector 类(或至少扩展它)以使其支持此功能。

标签: jquery mootools css-selectors prototypejs pseudo-class


【解决方案1】:

现在不可能,您需要等待 Prototype 1.7,它将使用 Sizzle 作为默认选择器引擎

【讨论】:

  • 我会期待的。谢谢。
【解决方案2】:

根据$$它支持:

$$('div:empty');
// -> all DIVs without content (i.e., whitespace-only)

【讨论】:

  • 你在哪里定义了 ":empty" 是什么?
猜你喜欢
  • 2012-03-23
  • 2015-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-28
  • 2011-07-19
  • 2016-09-27
  • 2019-09-17
相关资源
最近更新 更多