Changes between Initial Version and Version 4 of Ticket #15862


Ignore:
Timestamp:
Aug 24, 2012, 11:43:14 AM (8 years ago)
Author:
bill
Comment:

You are right that it's a dojo-Prototype compatibility issues; it's because Prototype adds an on() method to DOMNodes and that confuses dojo/on.js.

Specifically, in your test case:

  • Dialog is a dojo/dnd/Moveable, so a dojo/dnd/Mover is created, and that calls on(document, touch.move, lang.hitch(this, "onFirstMove"))
  • Since on.js sees a document.on() method, it delegates to that method. However, that method doesn't return a handle like on() expects.
  • later on, dojo/dnd/Moveable tries to call handle.remove(), but there's no such method.

In other words, the test case could be simplified to:

... include prototype ...
on(document, "mousemove", callback).remove()

I suppose that to workaround this we could skip checking for a target.on() method if the target is a DOMNode. Will leave it to Kris though if he wants to do that or not.

The method prototype adds looks like:

> document.on
function () {
      var a = update([this], arguments);
      return __method.apply(null, a);
    }

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15862

    • Property Owner changed from bill to Kris Zyp
    • Property Status changed from new to assigned
    • Property Component changed from Dijit to Events
    • Property Summary changed from Closing Dialog Box returns Uncaught TypeError: Object #<klass> has no method 'remove'' to on(document, ...) fails when Prototype included onto page
  • Ticket #15862 – Description

    initial v4  
    66}}}
    77
    8 JavaScript returns the following errors :
     8!JavaScript returns the following errors :
    99
    10 **Uncaught TypeError: Object #<klass> has no method 'remove'** (Mover.js 8)
     10**Uncaught !TypeError: Object #<klass> has no method 'remove'** (Mover.js 8)
    1111{{{
    1212   _2.onFirstMove Mover.js:8
     
    1616}}}
    1717
    18 **Uncaught TypeError: Object #<klass> has no method 'remove'** (Mover.js:8)
     18**Uncaught !TypeError: Object #<klass> has no method 'remove'** (Mover.js:8)
    1919{{{
    2020_2.destroy.h Mover.js:8
     
    2727}}}
    2828
    29 **Uncaught TypeError: Object #<klass> has no method 'remove' ** (Mover.js:8)
     29**Uncaught !TypeError: Object #<klass> has no method 'remove' ** (Mover.js:8)
    3030{{{
    3131_2.onFirstMove Mover.js:8
     
    3535}}}
    3636
    37 **Uncaught TypeError: Cannot call method 'remove' of undefined (Mover.js:8)**
     37**Uncaught !TypeError: Cannot call method 'remove' of undefined (Mover.js:8)**
    3838{{{
    3939_2.onFirstMove Mover.js:8