为了更好的理解,这是对早前问题的跟进。与其深入挖掘cssRules
,我想基于jQuery选择器搜索这些规则的效果来构建逻辑。
假设默认属性为
.commentarea .author:before {
background-image: url(http://...);
background-position: -9999px -9999px;
/* ... */
}
像选择性地修改那样
.author[href$="gbacon"]:before /* ... */ {
content: "";
background-position: 0 -140px
}
如何选择具有默认背景位置的伪元素?像这样复制选择器:
GM_log("size = " + $(".commentarea .author:before").size());
没有匹配项。尝试使用.siblings()
方法。
$(".commentarea .author")
.map(function(i) {
GM_log($(this)
.siblings()
.map(function (i) { return $(this).css("background-image") })
.get()
.join(", "))
});
只生成none
值。
完整的信息请参见实时页面。这个可能吗?
.class1 .class2
,只要元素的背景图像和位置是默认的(基于CSS规则)? - Chris Laplante.class1 .class2
,只要相邻的伪元素的背景位置是默认的。 - Greg Bacon