3

I am on dojo 1.7.2 and trying to use drag and drop for the first time.

In dojo/dnd/Source.js, in the function _legalMouseDown, there is this line:

// accept only the left mouse button
if(!dojo.mouseButtons.isLeft(e)){ return false; }

Comically, .isLeft is returning false even when I press the left mouse button.

This completely breaks the drag and drop functionality.

I've replaced the code locally with if(!e.button==0){return false;}, and this seems to be working.

There seem to be multiple implementations of .isLeft in dojo, some of them are doing ==0 and others are doing &1.

Question: Have I found a bug, or am I doing something silly?

If it helps to know, I've tested in Chrome (Version 20.0.1132.47) and Firefox (Version 13.0.1).

Harold
  • 1,584
  • 1
  • 12
  • 20

1 Answers1

3

Is your page using quirks mode? This is the known issue with quirks mode.

http://trac.dojotoolkit.org/ticket/15404

Your solution may have broken other browsers (IE), so make sure you test the browsers that your application supports.

Craig Swing
  • 8,152
  • 2
  • 30
  • 43
  • What is quirks mode? How do I know if my page is using it? – Harold Jul 06 '12 at 04:12
  • http://stackoverflow.com/questions/627097/how-to-tell-if-a-browser-is-in-quirks-mode – Craig Swing Jul 06 '12 at 10:25
  • Thanks for the lesson. I am in quirks mode in both Chrome and FF. As is mentioned in the trac ticket, .isLeft is just buggy. I appreciate your time. – Harold Jul 06 '12 at 16:09
  • 1
    +1, was just about to write same answer, set the correct DOCTYPE and run document through validation service and it will fix things. – mschr Jul 08 '12 at 12:37