Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1022)

Issue 11128043: Implement event propagation for listeners on TameWindow and TameDocument. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 8 months ago by kpreid2
Modified:
12 years, 7 months ago
Reviewers:
felix8a
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

For the most part, we use browser native event dispatch for our virtualized events. load and DOMContentLoaded events have been an exception for historical reasons (less confidence in the safe use of initEvent/dispatchEvent) and because there is no host DOM object corresponding to our TameWindow. With this change, we now always use native event dispatch (except for the window.onload _handler_, which is still a specialized kludge). * Refactor add/removeEventListener's "wrappedListeners" facility into new type EventListenerTable, which can be used standalone to perform virtual dispatch. * Introduce SplitEventTarget, which implements a virtual EventTarget for each of tameWindow and tameDocument, which dispatches events its own listeners see on the containerNode as if there were two distinct nodes. * Tame{Window,Document} {add,remove}EventListener are implemented using SplitEventTarget instead of delegating to other nodes. There are no longer any special cases for _listeners_ for load or DOMContentLoaded. Fixes <https://code.google.com/p/google-caja/issues/detail?id=1792>. * Implemented TameDocument.prototype.dispatchEvent (previously missing). * Implemented TameWindow.prototype.dispatchEvent (previously no-op). Supporting changes: * TameWindow gets a toString method. Some additional jQuery UI tests pass, but I have not updated the counts due to <https://code.google.com/p/google-caja/issues/detail?id=1803>.

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+293 lines, -167 lines) Patch
M src/com/google/caja/plugin/domado.js View 7 chunks +204 lines, -103 lines 4 comments Download
M tests/com/google/caja/plugin/es53-test-domado-dom-guest.html View 1 chunk +3 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-events-guest.html View 2 chunks +86 lines, -64 lines 0 comments Download

Messages

Total messages: 5
kpreid2
12 years, 8 months ago (2013-07-10 19:28:30 UTC) #1
kpreid2
Meta comment: I would be interested in ways to accomplish the same correctness improvements with ...
12 years, 8 months ago (2013-07-10 19:29:46 UTC) #2
felix8a
I'm confused about this change. it looks like dispatching an event to the tame window ...
12 years, 8 months ago (2013-07-10 21:32:52 UTC) #3
kpreid2
On 2013/07/10 21:32:52, felix8a wrote: > I'm confused about this change. it looks like dispatching ...
12 years, 8 months ago (2013-07-10 21:44:26 UTC) #4
kpreid2
12 years, 7 months ago (2013-07-24 22:38:39 UTC) #5
Closing this review as it is superseded by
<https://codereview.appspot.com/11775043/>.

https://codereview.appspot.com/11128043/diff/1/src/com/google/caja/plugin/dom...
File src/com/google/caja/plugin/domado.js (right):

https://codereview.appspot.com/11128043/diff/1/src/com/google/caja/plugin/dom...
src/com/google/caja/plugin/domado.js:3495: var record = typeTable[+i];
On 2013/07/10 21:32:52, felix8a wrote:
> why the + ?

There is an optimization in ES5/3 when the subscript is statically obviously a
number.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b