Opened 10 years ago
Closed 10 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)
Change History (3)
Changed 10 years ago by
Attachment: | fix-async-scope.patch added |
---|
comment:2 Changed 10 years ago by
Milestone: | tbd → 1.7 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
proposed patch