Package com.google.javascript.jscomp
Class ConformanceRules.BanCreateElement
- java.lang.Object
-
- com.google.javascript.jscomp.ConformanceRules.AbstractRule
-
- com.google.javascript.jscomp.ConformanceRules.BanCreateElement
-
- All Implemented Interfaces:
CheckConformance.Rule
- Enclosing class:
- ConformanceRules
public static final class ConformanceRules.BanCreateElement extends ConformanceRules.AbstractRule
Bansdocument.createElement
and similar methods with string literal parameter specified invalue
, e.g.value: 'script'
. The purpose of banning these is that they don't provide the type information which hinders other rules. Authors should use e.g.goog.dom.createElement(goog.dom.TagName.SCRIPT)
which returns HTMLScriptElement.
-
-
Constructor Summary
Constructors Constructor Description BanCreateElement(AbstractCompiler compiler, Requirement requirement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConformanceRules.ConformanceResult
checkConformance(NodeTraversal t, Node n)
-
Methods inherited from class com.google.javascript.jscomp.ConformanceRules.AbstractRule
check, report, tsIsAllowlisted
-
-
-
-
Constructor Detail
-
BanCreateElement
public BanCreateElement(AbstractCompiler compiler, Requirement requirement) throws CheckConformance.InvalidRequirementSpec
-
-
Method Detail
-
checkConformance
protected ConformanceRules.ConformanceResult checkConformance(NodeTraversal t, Node n)
- Specified by:
checkConformance
in classConformanceRules.AbstractRule
- Returns:
- Whether the code represented by the Node conforms to the rule.
-
-