DOMTimeStamp binding

DOM 3 Core says this about DOMTimeStamp:

> For Java, DOMTimeStamp is bound to the long type. For ECMAScript, DOMTimeStamp
> is bound to the Date type because the range of the integer type is too small.

However, when I do this:

> var e = document.createEvent('Events');
> alert( typeof e.timeStamp );

I get "number" in Opera and Firefox, and "object" in Webkit. Is there a reason Opera and Firefox bind the timestamps to numbers instead of the Date object? Are there any websites that depend on this behavior? I'm wondering because our implementation also binds it to a number (in error, based on the java interface). I only realized this when I saw the description for HTMLInputElement.valueAsDate in HTML5, which binds the DOMTimeStamp to a Date object for ECMAScript. (Opera inconsistently does return a Date here, even though it returns a number for Event.timeStamp).

Also, I'm not sure if WebIDL should say something for this; right now the DOM IDL files do a "typedef unsigned long long DOMTimeStamp", which corresponds to the Java binding but not the ECMAScript binding. Ideally it would allow typedefs to state different bindings for different languages, or something to that effect.

Cheers,
kats

Received on Wednesday, 11 February 2009 17:39:09 UTC