JavaScript-1.5 Reference

JS_DeleteElement2 Function

Summary

Removes a specified element or numeric property from an object.

Syntax

JSBool JS_DeleteElement2(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 an element.
nameconst char *Name of the element to delete.
rvaljsval *Pointer to the deleted value.

Description

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

Notes

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

For JavaScript 1.2 and earlier, if failure occurs because you attempt to delete a permanent element, JS_DeleteElement2 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 element.

To remove all elements and properties from an object, call JS_ClearScope.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_AliasElement | JS_ClearScope | JS_DefineElement | JS_DeleteElement | JS_GetArrayLength | JS_GetElement | JS_IsArrayObject | JS_LookupElement | JS_NewArrayObject | JS_SetArrayLength | JS_SetElement ]

This page was generated by APIDOC