4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-Element'>/**
19 </span> * @class Ext.Element
21 Ext.Element.addMethods({
22 <span id='Ext-Element-method-addKeyListener'> /**
23 </span> * Convenience method for constructing a KeyMap
24 * @param {String/Number/Number[]/Object} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:
25 * <code>{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</code>
26 * @param {Function} fn The function to call
27 * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed. Defaults to this Element.
28 * @return {Ext.util.KeyMap} The KeyMap created
30 addKeyListener : function(key, fn, scope){
32 if(typeof key != 'object' || Ext.isArray(key)){
48 return Ext.create('Ext.util.KeyMap', this, config);
51 <span id='Ext-Element-method-addKeyMap'> /**
52 </span> * Creates a KeyMap for this element
53 * @param {Object} config The KeyMap config. See {@link Ext.util.KeyMap} for more details
54 * @return {Ext.util.KeyMap} The KeyMap created
56 addKeyMap : function(config){
57 return Ext.create('Ext.util.KeyMap', this, config);
61 //Import the newly-added Ext.Element functions into CompositeElementLite. We call this here because
62 //Element.keys.js is the last extra Ext.Element include in the ext-all.js build
63 Ext.CompositeElementLite.importElementMethods();