JS DeleteElement2
From MDC
Remove a specified numeric property from an object.
Contents |
[edit] Syntax
JSBool JS_DeleteElement2(JSContext *cx, JSObject *obj, jsint index, jsval *rval);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
The context in which to delete the property.
Requires request. (In a |
obj |
JSObject * |
The object from which to delete the property. |
index |
jsint |
Index of the property to delete. |
rval |
jsval * |
Out parameter. On success, *rval receives the stored value of the deleted property. (???) |
[edit] Description
JS_DeleteElement2 removes a specified numeric property, index, from an object, obj. If rval is non-null, the final stored value of the deleted property is stored in *rval. If obj inherits the specified property from a prototype, the property is removed from the object, but not from the prototype. If deletion is successful, JS_DeleteElement2 returns JS_TRUE. Otherwise it returns JS_FALSE.
[edit] Notes
Per the ECMA standard, JS_DeleteElement2 removes read-only properties from objects as long as they are not also permanent.
For JavaScript 1.2 and earlier, if deletion fails because the property is permanent, JS_DeleteElement2 reports the error and returns JS_FALSE. For JavaScript 1.3, the attempt is silently ignored. In both these cases, *rval will receive the stored value of the property that was not deleted.
To remove all properties from an object, call JS_ClearScope.
[edit] See Also
LXR ID Search for JS_DeleteElement2
JS_DefineElement, JS_DeleteElement, JS_GetArrayLength, JS_GetElement, JS_IsArrayObject, JS_LookupElement, JS_NewArrayObject, JS_SetArrayLength, JS_SetElement