OSDN Git Service

fix X.UA & X.Audio, add X.KB.
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 03_XDomEvent.js
index 07886c0..391cdb9 100644 (file)
@@ -213,11 +213,12 @@ if( !X_UA[ 'IE' ] || 9 <= X_UA[ 'IE' ] ){
                } else {\r
                        // Other\r
                        \r
-                       this[ 'keyCode' ]       = e.keyCode || e.which;\r
-                       this[ 'altKey' ]        = e.altKey;\r
-                       this[ 'ctrlKey' ]       = e.ctrlKey;\r
-                       this[ 'shiftKey' ]      = e.shiftKey;\r
-                       this[ 'metaKey' ]       = e.metaKey;\r
+                       this[ 'keyCode' ]       = X_Type_isFinite( e.keyCode ) ? e.keyCode : X_Type_isFinite( e.charCode ) ? e.charCode : e.which;\r
+                       this[ 'charCode' ]      = X_Type_isFinite( e.charCode ) ? e.charCode : e.which;\r
+                       this[ 'altKey' ]        = e.altKey   || !!( e.modifiers & 1 );\r
+                       this[ 'ctrlKey' ]       = e.ctrlKey  || !!( e.modifiers & 2 );\r
+                       this[ 'shiftKey' ]      = e.shiftKey || !!( e.modifiers & 4 );\r
+                       this[ 'metaKey' ]       = e.metaKey  || !!( e.modifiers & 8 );;\r
                        \r
                        this[ 'button' ]        = e.button !== undefined ? e.button :\r
                                                                 e.which !== undefined ? e.which - 1 : -1;\r
@@ -272,9 +273,11 @@ if( !X_UA[ 'IE' ] || 9 <= X_UA[ 'IE' ] ){
                if( this[ 'target' ] && !this[ 'target' ][ '_tag' ] ) this[ 'target' ] = this[ 'target' ].parent; // ie4 の fake Textnode がヒットしていないか?\r
                this[ 'currentTarget' ] = xnode; // xnode\r
                this[ 'relatedTarget' ] = X_Node_getXNode( e.formElement || e.toElement ); // xnode\r
+               this[ 'relatedTarget' ] && console.dir( 'relatide...' );\r
                this[ 'eventPhase' ]    = e.srcElement === element ? 2: 3;\r
                \r
                this[ 'keyCode' ]       = e.keyCode;\r
+               this[ 'charCode' ]      = e.keyCode;\r
                this[ 'altKey' ]        = e.altKey;\r
                this[ 'ctrlKey' ]       = e.ctrlKey;\r
                this[ 'shiftKey' ]      = e.shiftKey;           \r