DOMException

本文深入探讨了DOM操作中可能出现的异常类型及对应的错误代码,包括但不限于范围外索引、字符串大小限制、层级请求错误等常见问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.w3.org/wiki/DOM/domcore/DOMException


DOM/domcore/DOMException

DOM‎ | domcore

DOMException

DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when using NodeList.

ExceptionCode

CodeConstantDescription
1INDEX_SIZE_ERRthe index is not in the allowed range
2DOMSTRING_SIZE_ERRthe text does not fit in a DOMString
3HIERARCHY_REQUEST_ERRthe operation would yield an incorrect nodes model
4WRONG_DOCUMENT_ERRthe object is in the wrong Document, a call to importNode is required
5INVALID_CHARACTER_ERRthe string contains invalid characters
6NO_DATA_ALLOWED_ERRdata is specified for an object that does not support it (historical)
7NO_MODIFICATION_ALLOWED_ERRthe object can not be modified
8NOT_FOUND_ERRthe object can not be found here
9NOT_SUPPORTED_ERRthis operation is not supported
10INUSE_ATTRIBUTE_ERRthe attribute is in use (historical)
11INVALID_STATE_ERRthe object is in an invalid state
12SYNTAX_ERRthe string did not match the expected pattern
13INVALID_MODIFICATION_ERRthe object can not be modified in this way
14NAMESPACE_ERRthe operation is not allowed by Namespaces in XML
15INVALID_ACCESS_ERRthe object does not support the operation or argument
16VALIDATION_ERRthe operation is invalid (historical)
17TYPE_MISMATCH_ERRthe type of the object does not match the expected type
18SECURITY_ERRthe operation is insecure
19NETWORK_ERRa network error occurred
20ABORT_ERRthe user aborted an operation
21URL_MISMATCH_ERRthe given URL does not match another URL
22QUOTA_EXCEEDED_ERRthe quota has been exceeded
23TIMEOUT_ERRa timeout occurred
24INVALID_NODE_TYPE_ERRthe supplied node is invalid or has an invalid ancestor for this operation
25DATA_CLONE_ERRthe object can not be cloned
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值