What throws DOMErrors

Introduction

DOMError is an interface defined by the DOM.

I would like to check if the browser supports it. Naive check

window.DOMError !== undefined

A better check would be to use an action that throws a DOMError and checks that

err instanceof DOMError === true

Question

What actions throw DOMErrors?

+5
source share
3 answers

A DOMErroris the condition for an exception-based error. It will never be thrown, except that an object that implements both DOMErrorand DOMExceptioncan be dropped as DOMException.

, , DOMError DOMException, DOM, DOMException, . , , DOMError.

DOMError, DOM4, , . , , , , .

W3 File API FileReader, , , . API- File API DOMError -, DOM4 , .

DOMError, DOM Level 3 Core, , . DOM Level 3 LS, Core document.normalizeDocument, /.

DOMError, DOM 4, DOM Level 3 LS normalizeDocument. - DOM ; pxdom DOM 3.

+2

Firefox (), Chrome 17 .

w3 . . :

, , . , .

, DOMException. labled- ( ), , .

DOM Level 3.

: ThinkingStiff, , . (Opera 11.52):

Uncaught exception: TypeError: 'DOMError' is not a constructor  
Uncaught exception: TypeError: 'DOMError' is not a function

Java DOM: DOMError.

+1

DOMErrors occur when trying to create an invalid DOM element or pass a nonexistent node as an argument to node manipulation methods. In other words, an exception occurs when the operation cannot be completed.

Example:

document.querySelectorAll("div:foo");

This raises a DOMError when div: foo does not exist.

-1
source

All Articles