#14606 closed defect (fixed)
Dojo 1.7.1 AMD mode and Prototype 1.7 "on" problem
Reported by: | Matias Rask | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | high | Milestone: | 1.8 |
Component: | Events | Version: | 1.7.1 |
Keywords: | on, prototype | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
When using Dojo 1.7.1 in AMD mode and Prototype 1.7 on the same page the following error is thrown in Google Chrome 16.0.912.63 when trying to instantiate a dijit.widget (which uses dojo/on)
note: prototype_compressed_1.js is actually the same thing as prototype.js
Uncaught TypeError: Object function (object, listener){ prototype_compressed_1.js:5560 var keydownSignal = on(object, "keydown", function(evt){ // munge key/charCode var k=evt.keyCode; // These are Windows Virtual Key Codes // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp var unprintable = (k!=13 || (has("ie") >= 9 && !has("quirks"))) && k!=32 && (k!=27||!has("ie")) && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222) && k!=229; // synthesize keypress for most unprintables and CTRL-keys if(unprintable||evt.ctrlKey){ var c = unprintable ? 0 : k; if(evt.ctrlKey){ if(k==3 || k==13){ return listener.call(evt.currentTarget, evt); // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively }else if(c>95 && c<106){ c -= 48; // map CTRL-[numpad 0-9] to ASCII }else if((!evt.shiftKey)&&(c>=65&&c<=90)){ c += 32; // map CTRL-[A-Z] to lowercase }else{ c = _punctMap[c] || c; // map other problematic CTRL combinations to ASCII } } // simulate a keypress event var faux = _synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c}); listener.call(evt.currentTarget, faux); if(has("ie")){ _trySetKeyCode(evt, faux.keyCode); } } }); var keypressSignal = on(object, "keypress", function(evt){ var c = evt.charCode; c = c>=32 ? c : 0; evt = _synthesizeEvent(evt, {charCode: c, faux: true}); return listener.call(this, evt); }); return { remove: function(){ keydownSignal.remove(); keypressSignal.remove(); } }; } has no method 'include' _createResponder prototype_compressed_1.js:5560 observe prototype_compressed_1.js:5630 Event.Handler.Class.create.start prototype_compressed_1.js:5745 on prototype_compressed_1.js:5766 _methodized prototype_compressed_1.js:438 on on.js:42 connect _connect.js:48 connect.connect connect.js:179 dispatcher.around.advice aspect.js:189 (anonymous function) aspect.js:104 declare.onClick _Widget.js:44 signal.advice aspect.js:113 target.(anonymous function) aspect.js:176 declare.connect _WidgetBase.js:844 inherited declare.js:191 declare.connect _OnDijitClickMixin.js:122 declare._attachTemplateNodes _TemplatedMixin.js:215 declare.buildRendering _TemplatedMixin.js:129 inherited declare.js:191 declare.buildRendering _Container.js:28 declare.create _WidgetBase.js:323 declare.postscript _WidgetBase.js:269 a declare.js:331 dojo.parser.instantiate parser.js:323 forEach array.js:279 dojo.parser.instantiate parser.js:124 dojo.parser.parse parser.js:582 declare._beforeFillContent _WidgetsInTemplateMixin.js:36 declare.buildRendering _TemplatedMixin.js:131 declare.create _WidgetBase.js:323 declare.postscript _WidgetBase.js:269 a declare.js:331 (anonymous function) main.js:2 runFactory dojo.js:997 execModule dojo.js:1123 execModule dojo.js:1114 checkComplete dojo.js:1146 onLoadCallback dojo.js:1311 req.injectUrl.onLoad dojo.js:1537
Bill Keese suspects that
on(object, "keydown", function(evt){ console.log(evt); });
produces the same result
I'm not sure if this is a Dojo problem or if the fault lies within Prototype.
Ref: http://dojo-toolkit.33424.n3.nabble.com/Dojo-1-7-1-AMD-with-Prototype-1-7-td3644489.html
Change History (6)
comment:1 Changed 9 years ago by
Cc: | [email protected]… added |
---|
comment:3 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|
comment:4 Changed 9 years ago by
Kris, are you sure about this change? I already fixed #15559 so the problem in this ticket may have already been fixed... not sure, I don't understand it exactly.
I don't really care, but just wanted to point out that this change is stopping people from doing something like:
on.once(myWidget, touch.press, ...)
comment:5 Changed 9 years ago by
Bill, I can still reproduce this issue with #15559, so I don't think that fixes the issue. However, #15559 does mean that my fix isn't really correct for interacting with Dijit. But, alternately would this change [29140] fix #15559 so that _WidgetBase doesn't need to worry about function event types anymore (the function would delegate back to on() which would eventually lead to string event types that would be delegated to Dijit)?
We're seeing this problem as well, and will try to get a simple test case put together asap.