Victor Victor - 2 months ago 15
Javascript Question

dojo cross browser compatibility

I recently posted a question on stackoverflow about the less popular js function

document.captureEvents()
. For most browsers, it is not necessary to use this capture. The question and answers are here:

javascript :Object doesn't support this property or method

However, it was suggested to be absolutely safe, a dojo solution should be used to abstract away browser differences.

I found some dojo code samples on the web related to generic usage i.e. using dojo syntax to declare form inputs etc.
But is there an example to use dojo for this particular problem of
document.captureEvents()
.
In short, how to do
document.captureEvents
in dojo. Is dojo suited for this particular problem case?

Answer

Dojo makes handling events very easy. If you wanted to capture mouse up event on the page as your other question seems to do, you would use:

dojo.connect( dojo.body(), 'mouseup', function( event ) { console.log( event ); } );

Replacing the function body with whatever functionality you need.