Ticket #7650 (closed defect: fixed)
Declaration: can't really create/override methods
| Reported by: | bill | Owned by: | bill |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3 |
| Component: | Dijit | Version: | 1.2beta |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The Declaration code lets you declare a class with methods:
<table dojoType="dijit.Declaration" widgetClass="demo.Table" ...> <script type="dojo/method" event="onSort" args="index"> ... </script> </div>
Unfortunately methods declared this way are implemented as connections, rather than as real methods in the declared class' prototype. This leads to many issues including:
- can't return a value
- can't override an existing method
- i suspect this.inherited() doesn't work
It also breaks the deferredConnect code in Widget.js that checks whether an event handler method has been redefined from a sentinel value:
for(attr in this._deferredConnects){
if(this[attr] !== dijit._connectOnUseEventHandler){
delete this._deferredConnects[attr]; // redefined, probably dojoAttachEvent exists
}
}
... last issue is leading to JS errors in mail demo when clicking an item in the inbox, since an unwanted connection is getting setup from this.domNode.onclick --> this.onClick.
Change History
Note: See
TracTickets for help on using
tickets.