JavaScript-1.5 Reference

JS_DeleteProperty2 Function

Summary

Removes a specified property from an object.

Syntax

JSBool JS_DeleteProperty2(JSContext *cx, JSObject *obj,
    const char *name, jsval *rva);
NameTypeDescription
cxJSContext *Pointer to a JS context from which to derive runtime information.
objJSObject *Object from which to delete a property.
nameconst char *Name of the property to delete.
rvaljsval *Pointer to the deleted value.

Description

JS_DeleteProperty2 removes a specified property, name, from an object, obj, and stores a pointer to the deleted property in rval. If rval is NULL, the property is deleted. If an object references a property belonging to a prototype, the property reference is removed from the object, but the prototype's property is not deleted. If deletion is successful, JS_DeleteProperty2 returns JS_TRUE. Otherwise it returns JS_FALSE.

Notes

Per the ECMA standard, JS_DeleteProperty2 removes read-only properties from objects as long as those properties are not also permanent.

For JavaScript 1.2 and earlier, if failure occurs because you attempt to delete a permanent property, JS_DeleteProperty2 reports the error before returning JS_FALSE. For JavaScript 1.3, the attempt is silently ignored. In both these cases, rval will contain a non-NULL pointer to the undeleted property.

To remove all properties from an object, call JS_ClearScope.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_AliasProperty | JS_ClearScope | JS_DefineProperty | JS_DefinePropertyWithTinyId | JS_DefineUCProperty | JS_DefineUCPropertyWithTinyID | JS_DeleteProperty | JS_DeleteUCProperty2 | JS_GetProperty | JS_GetUCProperty | JS_LookupProperty | JS_LookupUCProperty | JS_PropertyStub | JS_SetProperty | JS_SetUCProperty ]

This page was generated by APIDOC