SASS是否支持元素规范作为嵌套选择器?

Pro*_*tas 1 css sass

假设你有这个SASS定义(不真实的例子):

.class {
    margin: 1px;
    background: black;
    color: white;

    &:hover {
        color: red;
    }
}

a.class {
    margin: 1px;
    background: black;
    color: yellow;

    &:hover {
        color: blue;
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,我们可以将a同一类的规范作为嵌套选择器吗?像这样的东西(伪代码):

.class {
    margin: 1px;
    background: black;
    color: white;

    &:hover {
        color: red;
    }

    // Some selector to show that the current class
    // should be applied to this element (?)
    a.& {
        color: yellow;

        &:hover {
            color: blue;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Zee*_*atz 5

我有一个解决方案.它有点棘手,但它的工作正常.

.class {
    color: yellow;

    &:hover {
        color: blue;
    }
    &[href] {
        color: white;

        &:hover {
            color: red;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

工作小提琴