简体   繁体   中英

selecting pseudo-elements with mootools

Using MooTools,is it possible to select elements generated using the css pseudo-selectors ':before' and ':after'? 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.

.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.

The generated content from the :before and :after pseudo-classes are not part of the DOM tree. So it's not accessible from 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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