W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2004

DOMErrorHandler, EventListener, et al in ECMAScript binding

From: Curt Arnold <carnold@houston.rr.com>
Date: Wed, 10 Mar 2004 21:27:19 -0600
Message-Id: <00EC1398-730C-11D8-BFC5-000393B97126@houston.rr.com>
To: www-dom@w3.org

I'd like to double check my interpretations of the ECMAScript binding's  
expectations for caller provided object.

 From  
http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/ecma-script- 
binding.html:

> Object EventListener
> This is an ECMAScript function reference. This method has no return  
> value. The parameter is a Event object.
>
> function clickHandler(evt)
>   {
>     // Function contents
>   }
>
>   // The following line will add a non-capturing 'click' listener
>   // to 'exampleNode'.
>   exampleNode.addEventListener("click", clickHandler, false);

 From  
http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ 
ecma-script-binding.html

> Object NodeFilter
> This is an ECMAScript function reference. This method returns a  
> Number. The parameter is a Node object.

 From L3 Events:  
http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/ecma-script- 
binding.html

> EventListener function:
> This function has no return value.  The parameter is an object that  
> implements the Event interface.

 From  
http://www.w3.org/TR/2004/PR-DOM-Level-3-Core-20040205/ecma-script- 
binding.html

> Objects that implement the DOMErrorHandler interface:
> Functions of objects that implement the DOMErrorHandler interface:
> handleError(error)
> This function returns a Boolean.
> The error parameter is an object that implements the DOMError  
> interface.
>
> Objects that implement the UserDataHandler interface:
> Functions of objects that implement the UserDataHandler interface:
> handle(operation, key, data, src, dst)
> This function has no return value.
> The operation parameter is a Number.
> The key parameter is a String.
> The data parameter is an object that implements the any type interface.
> The src parameter is an object that implements the Node interface.
> The dst parameter is an object that implements the Node interface.

 From  
http://www.w3.org/TR/2004/PR-DOM-Level-3-LS-20040205/ecma-script- 
binding.html

>
> Objects that implement the LSParserFilter interface:
> Properties of objects that implement the LSParserFilter interface:
> whatToShow
> This read-only property is a Number.
> Functions of objects that implement the LSParserFilter interface:
> startElement(elementArg)
> This function returns a Number.
> The elementArg parameter is an object that implements the Element  
> interface.
>  acceptNode(nodeArg)
> This function returns a Number.
> The nodeArg parameter is an object that implements the Node interface.

> Objects that implement the LSResourceResolver interface:
> Functions of objects that implement the LSResourceResolver interface:
> resolveResource(type, namespaceURI, publicId, systemId, baseURI)
> This function returns an object that implements the LSInput interface.
> The type parameter is a String.
> The namespaceURI parameter is a String.
> The publicId parameter is a String.
> The systemId parameter is a String.
> The baseURI parameter is a String.
>

> Objects that implement the LSSerializerFilter interface:
> Objects that implement the LSSerializerFilter interface have all  
> properties and functions of the NodeFilter interface as well as the  
> properties and functions defined below.
> Properties of objects that implement the LSSerializerFilter interface:
> whatToShow
> This read-only property is a Number.

It is pretty explicit that a function object is used for EventListeners  
and NodeFilters.  Am I right in interpreting that the DOMErrorHandler,  
UserDataHandler, LSSerializerFilter, LSParserFilter and  
ResourceResolver are passed as objects, something like:

function MyDOMErrorHandler() {
}

MyDOMErrorHander.prototype.handleError = function(err) {
}

var errorHandler = new MyDOMErrorHandler();
document.domConfig.setParameter('error-handler', errorHandler);

This description of LSSerializerFilter could use some clarification  
since it says the object has all the properties NodeFilter, but  
NodeFilter is a function object. 
Received on Wednesday, 10 March 2004 22:27:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:57 GMT