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
Bans
document.createElement and similar methods with string literal parameter specified
in value, 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
ConstructorsConstructorDescriptionBanCreateElement(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) -
Method Summary
Methods inherited from class com.google.javascript.jscomp.ConformanceRules.AbstractRule
check, report, tsIsAllowlistedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.javascript.jscomp.CheckConformance.Rule
getPrecondition
-
Constructor Details
-
BanCreateElement
public BanCreateElement(AbstractCompiler compiler, com.google.javascript.jscomp.Requirement requirement) throws CheckConformance.InvalidRequirementSpec
-
-
Method Details
-
checkConformance
- Specified by:
checkConformancein classConformanceRules.AbstractRule- Returns:
- Whether the code represented by the Node conforms to the rule.
-