Maheshjayachandran / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

goog.ui.Control ACTION event in compiled mode #397

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
thanks for the report!

Original comment by Nicholas.J.Santos on 30 Nov 2011 at 1:47

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1436.

Original comment by nicksan...@google.com on 1 Dec 2011 at 2:20