Opened 9 years ago
Closed 8 years ago
#14754 closed task (wontfix)
[patch] [cla] when possible use delegate() rather than mixin() for faux keypress/keydown events
Reported by: | bill | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Events | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | #14114 |
Description (last modified by )
dojo.connect() generates faux events for keypress/keydown normalized to the firefox behavior.
Although this normalization code is going away for 2.0, I think it makes sense to add a small optimization now, to use delegate() rather than mixin() when possible.
Delegate() will theoretically be more efficient than mixin(), but more importantly it will avoid a lot of the scary "event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future." console warnings, see #14114.
The "problem" is simply that the mixin() call accesses all the attributes of the event object, including the deprecated layerX and layerY attributes, generating a spurious warning.
See attached patch with manual test case.
The reason we can't use delegate all the time is that on IE the event object seems to disappear out from under us, so we can't access things like evt.type in the faux object. Also, IE9 gives strange errors when you try to delegate. (So we can't branch based on has("dom-addEventListener"). Maybe there's another way but I just did !has("ie") in my patch.)
Attachments (1)
Change History (4)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
Changed 9 years ago by
Attachment: | connectDelegate.patch added |
---|
comment:2 Changed 9 years ago by
Blocking: | 14114 added |
---|
(In #14114) That happens in 1.7 but it's already been fixed in trunk.
comment:3 Changed 8 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Since webkit removed the warning message, and since the synthetic keypress event will disappear completely in 2.0, we should probably close this as wontfix.
one line change plus test file