How to reproduce:
1. Listen for an ACTION event on a goog.ui.Control
2. Click on the Control while holding down Ctrl or Meta (Mac) key.
3. On the event handler, check the value of the 'platformModifierKey' property
in the event.
Expected result:
The event handler should receive an event object where the property
platformModifierKey is set to true.
This works fine in *uncompiled* mode, but in *compiled* mode (i.e. the
properties are renamed), the property 'platformModifierKey' is undefined.
What version of the product are you using? On what operating system?
Revision 1419. Google Chrome.
Cause:
The problem is located in goog.ui.Control#performActionInternal (line 1287).
performActionInternal creates a new Event object and adds the following
properties in this object: 'altKey', 'ctrlKey', 'metaKey', 'shiftKey',
'platformModifierKey'.
These properties are copied from the event object it receives as the first
argument, using the same names (which are quoted).
Since the properties 'altKey', 'ctrlKey', 'metaKey' and 'shiftKey' come from
the browser event and are declared in the externs, they won't get renamed by
the compiler.
'platformModifierKey', however, is declared inside the Closure library and thus
will get renamed when compiled.
Possible solution:
Copy platformModifierKey in unquoted form to the new ACTION event object.
Original issue reported on code.google.com by alo.and on 29 Nov 2011 at 6:58
Original issue reported on code.google.com by
alo.and
on 29 Nov 2011 at 6:58