Call hasOwnProperty
, isPrototypeOf
, propertyIsEnumerable
methods only from Object.prototype
.
Otherwise it can cause errors.
Apply with the Grit CLI
grit apply no_prototype_builtins
Calling hasOwnProperty
method from Object.prototype
BEFORE
var hasProperty = woo.hasOwnProperty("top");
AFTER
var hasProperty = Object.prototype.hasOwnProperty.call(woo, "top");
Calling isPrototypeOf
method from Object.prototype
BEFORE
var isPrototypeOf = woo.isPrototypeOf(top);
AFTER
var isPrototypeOf = Object.prototype.isPrototypeOf.call(woo, top);
Calling propertyIsEnumerable
method from Object.prototype
BEFORE
var isEnumerable = woo.propertyIsEnumerable("top");
AFTER
var isEnumerable = Object.prototype.propertyIsEnumerable.call(woo, "top");
Do not change methods for {}
object
JAVASCRIPT
var isPrototypeOf = {}.isPrototypeOf.call(woo, top);
Do not change methods for Object.prototype
JAVASCRIPT
var hasProperty = Object.prototype.hasOwnProperty.call(woo, "top");