public final class Equivalents extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Equivalents.AtRuleBase<N extends Named>
base for walkers that group
AtRule s together |
static class |
Equivalents.Base<G extends Groupable<?,G>,N extends Named>
base for walkers that group any Groupable together
|
static interface |
Equivalents.EquivalentWalker<P,N extends Named>
Responsible for finding the next and previous "peers", and also for determining whether a "peer" is an prefixed
equivalent.
|
static class |
Equivalents.RuleBase<N extends Named>
base for walkers that group
Rule s together |
Modifier and Type | Field and Description |
---|---|
static Equivalents.EquivalentWalker<AtRule,AtRule> |
AT_RULES
Finds at-rules with prefixed-equivalent names.
|
static Equivalents.EquivalentWalker<Declaration,FunctionValue> |
FUNCTION_VALUES
Finds declarations with prefixed-equivalent function values.
|
static Equivalents.EquivalentWalker<Declaration,Declaration> |
PROPERTIES
Finds declarations with prefixed-equivalent property names.
|
static Equivalents.EquivalentWalker<Rule,PseudoClassSelector> |
PSEUDO_CLASSES
Finds rules with prefixed-equivalent pseudo class selectors.
|
static Equivalents.EquivalentWalker<Rule,PseudoElementSelector> |
PSEUDO_ELEMENTS
Finds rules with prefixed-equivalent pseudo element selectors.
|
Modifier and Type | Method and Description |
---|---|
static <P,N extends Named> |
prefixes(P peer,
N unprefixed,
Equivalents.EquivalentWalker<P,N> walker)
Finds all peers of the given unit that match the same name, but with a prefix.
|
public static final Equivalents.EquivalentWalker<Declaration,Declaration> PROPERTIES
For example, given the following css:
.example {
color: red;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
When given the last declaration in the rule, this will locate both the -webkit-border-radius
and the -moz-border-radius
declarations.
public static final Equivalents.EquivalentWalker<Declaration,FunctionValue> FUNCTION_VALUES
For example, given the following css:
.example {
width: -webkit-calc(2px - 1px);
color: red;
width: calc(2px - 1px);
}
When given the last declaration in the rule and a functionName of "calc", this will locate the first declaration, which
contains the -webkit-calc
function.public static final Equivalents.EquivalentWalker<AtRule,AtRule> AT_RULES
For example, given the following css:
@-webkit-keyframes {
from { top: 0%}
to { top: 100%}
}
@keyframes {
from { top: 0%}
to { top: 100%}
}
@-moz-keyframes {
from { top: 0%}
to { top: 100%}
}
When given the middle, unprefixed at-rule, the at-rules before and after it will be returned. Only immediately adjacent
at-rules will be considered.
Note that this only compares immediately adjacent peers, for as long as a match is found. The first peer that does not match prefix and raw expression content will halt looking in that direction (before and after).
public static final Equivalents.EquivalentWalker<Rule,PseudoElementSelector> PSEUDO_ELEMENTS
For example, given the following css:
@::-moz-selection {
color: red;
}
@::selection {
color: red;
}
When given the second, unprefixed rule, the one before it will be returned. Only immediately adjacent rules will be
considered.
Note that this only compares immediately adjacent peers, for as long as a match is found. The first peer that does not match will halt looking in that direction (before and after).
public static final Equivalents.EquivalentWalker<Rule,PseudoClassSelector> PSEUDO_CLASSES
For example, given the following css:
@:blah {
color: red;
}
@:blah {
color: red;
}
When given the second, unprefixed rule, the one before it will be returned. Only immediately adjacent rules will be
considered.
Note that this only compares immediately adjacent peers, for as long as a match is found. The first peer that does not match will halt looking in that direction (before and after).
public static <P,N extends Named> com.google.common.collect.Multimap<Prefix,P> prefixes(P peer, N unprefixed, Equivalents.EquivalentWalker<P,N> walker)
What constitutes a "peer", and how matches are determined is based on the given Equivalents.EquivalentWalker
.
P
- (P)eer. The type of units that are considered peers and also the type of unit that will be returned in the map.N
- (N)amed unit. The unit that has the unprefixed name. This could be the same type as P
, or it could be a unit
that's a child of P
.peer
- The peer that is unprefixed. Usually this is either the same unit as unprefixed, or a parent of unprefixed.unprefixed
- The unprefixed unit.walker
- Handles the specifics of finding the peers.Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.