Package com.google.javascript.jscomp
Class ConformanceRules.BanSetAttribute
- java.lang.Object
-
- com.google.javascript.jscomp.ConformanceRules.AbstractRule
-
- com.google.javascript.jscomp.ConformanceRules.BanSetAttribute
-
- All Implemented Interfaces:
CheckConformance.Rule
- Enclosing class:
- ConformanceRules
public static final class ConformanceRules.BanSetAttribute extends ConformanceRules.AbstractRule
BanElement#setAttribute
with attribute names specified invalue
or any dynamic string.Using the element access syntax to set properties of
Element
is considered to be equivalent to callingElement#setAttribute
. E.g.,element[prop] = value
is treated aselement.setAttribute(prop, value)
whenelement
has the typeElement
.
-
-
Constructor Summary
Constructors Constructor Description BanSetAttribute(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement)
Create a custom checker to banElement#setAttribute
based on conformance a requirement spec.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConformanceRules.ConformanceResult
checkConformance(NodeTraversal traversal, Node node)
-
Methods inherited from class com.google.javascript.jscomp.ConformanceRules.AbstractRule
check, report, tsIsAllowlisted
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.javascript.jscomp.CheckConformance.Rule
getPrecondition
-
-
-
-
Constructor Detail
-
BanSetAttribute
public BanSetAttribute(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) throws CheckConformance.InvalidRequirementSpec
Create a custom checker to banElement#setAttribute
based on conformance a requirement spec. Names invalue
fields indicate the attribute names that should be blocked. ThrowsCheckConformance.InvalidRequirementSpec
if the requirement is malformed.
-
-
Method Detail
-
checkConformance
protected ConformanceRules.ConformanceResult checkConformance(NodeTraversal traversal, Node node)
- Specified by:
checkConformance
in classConformanceRules.AbstractRule
- Returns:
- Whether the code represented by the Node conforms to the rule.
-
-