简体   繁体   English

用mootools选择伪元素

[英]selecting pseudo-elements with mootools

Using MooTools,is it possible to select elements generated using the css pseudo-selectors ':before' and ':after'? 使用MooTools,是否可以选择使用css伪选择器生成的元素:在'和'之前':'之后? Specifically, I'm defining the element below, and trying to adjust its height with javascript, but I can't get a reference to the element so I'm unable to modify it. 具体来说,我正在定义下面的元素,并尝试使用javascript调整其高度,但我无法获得对元素的引用,因此我无法修改它。

.stuff:before {
    width: 100px;
    height: 36px;
    background: blue;
    content: "";
    float: left;
    position: absolute;
    opacity: 0.5;
}

I'm not 100% sure, but i think you can't access those property. 我不是百分百肯定,但我认为你无法访问这些财产。 And it's not because of MooTools. 而且这不是因为MooTools。

The generated content from the :before and :after pseudo-classes are not part of the DOM tree. 来自:before:after伪类的生成内容不是DOM树的一部分。 So it's not accessible from JavaScript. 所以它无法通过JavaScript访问。 At all. 完全没有。

That said, the browser uses it to render the page, so in fact, it knows them internally. 也就是说,浏览器使用它来呈现页面,所以事实上,它在内部知道它们。 This will possibly become accessible in the future with the Shadow DOM feature. 将来可能会使用Shadow DOM功能访问它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM