Opened 9 years ago

Closed 8 years ago

#12849 closed defect (fixed)

Async Load of "url" of IconItem is broken due to incorrect scope

Reported by: Ming Zhe Huang Owned by: ykami
Priority: high Milestone: 1.7
Component: DojoX Mobile Version: 1.6.0
Keywords: AMD regression Cc:
Blocked By: Blocking:

Description

The following definition of an IconItem? used to work. <li dojoType="dojox.mobile.IconItem?" label="url-async" icon="icon.png" url="test.html" transition="slide" sync="false"></li>

It's broken now in trunk, due to AMD refactoring. If you click the icon, there will be error message like: "Failed to load test.html TypeError?: Object [object DOMWindow] has no method 'transitionTo'"

The root cause is inside transitionTo() of _ItemBase. If the loading is async, then it will first use xhr to get the target HTML. However, "this" attached to the callback is wrong. "this" passed in by require() is the global, not the current scope. The fix just bind the current scope to the callback of require().

Attachments (1)

fix-async-scope.patch (1.5 KB) - added by Ming Zhe Huang 9 years ago.
proposed patch

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by Ming Zhe Huang

Attachment: fix-async-scope.patch added

proposed patch

comment:1 Changed 9 years ago by Chris Mitchell

fixed in [24635]

comment:2 Changed 8 years ago by ykami

Milestone: tbd1.7
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.