Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / source / Element.html
index 445f1f8..2bb0d88 100644 (file)
@@ -1,11 +1,17 @@
-<html>\r
-<head>\r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
-    <pre class="prettyprint lang-js">/**\r
+<html>
+<head>
+  <title>The source code</title>
+    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body  onload="prettyPrint();">
+    <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**\r
  * @class Ext.Element\r
  * <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>\r
  * <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>\r
@@ -133,7 +139,7 @@ El.prototype = {
             }\r
         }\r
         if(o.style){\r
-            Ext.DomHelper.applyStyles(el, o.style);\r
+            DH.applyStyles(el, o.style);\r
         }\r
         return this;\r
     },\r
@@ -146,6 +152,13 @@ El.prototype = {
      * @param {HtmlElement} t The target of the event.\r
      * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
      */\r
+    <div id="event-Ext.Element-contextmenu"></div>/**\r
+     * @event contextmenu\r
+     * Fires when a right click is detected within the element.\r
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
+     * @param {HtmlElement} t The target of the event.\r
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
+     */\r
     <div id="event-Ext.Element-dblclick"></div>/**\r
      * @event dblclick\r
      * Fires when a mouse double click is detected within the element.\r
@@ -445,11 +458,11 @@ El.prototype = {
 \r
     <div id="method-Ext.Element-addListener"></div>/**\r
      * Appends an event handler to this element.  The shorthand version {@link #on} is equivalent.\r
-     * @param {String} eventName The type of event to handle\r
+     * @param {String} eventName The name of event to handle.\r
      * @param {Function} fn The handler function the event invokes. This function is passed\r
      * the following parameters:<ul>\r
      * <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>\r
-     * <li><b>el</b> : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.\r
+     * <li><b>el</b> : HtmlElement<div class="sub-desc">The DOM element which was the target of the event.\r
      * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>\r
      * <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>\r
      * </ul>\r
@@ -563,10 +576,10 @@ el.removeListener('click', this.handlerFn);
 // or\r
 el.un('click', this.handlerFn);\r
 </code></pre>\r
-     * @param {String} eventName the type of event to remove\r
-     * @param {Function} fn the method the event invokes\r
-     * @param {Object} scope (optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults\r
-     * to this Element.\r
+     * @param {String} eventName The name of the event from which to remove the handler.\r
+     * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>\r
+     * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,\r
+     * then this must refer to the same object.\r
      * @return {Ext.Element} this\r
      */\r
     removeListener : function(eventName, fn, scope){\r
@@ -630,16 +643,19 @@ el.un('click', this.handlerFn);
             dom = me.dom;\r
         \r
         me.removeAllListeners();\r
-        delete El.cache[dom.id];\r
-        delete El.dataCache[dom.id]\r
-        Ext.removeNode(dom);\r
+        if (dom) {\r
+            delete me.dom;\r
+            delete El.cache[dom.id];\r
+            delete El.dataCache[dom.id];\r
+            Ext.removeNode(dom);\r
+        }\r
     },\r
 \r
     <div id="method-Ext.Element-hover"></div>/**\r
      * Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.\r
      * @param {Function} overFn The function to call when the mouse enters the Element.\r
      * @param {Function} outFn The function to call when the mouse leaves the Element.\r
-     * @param {Object} scope (optional) The scope (<tt>this</tt> reference) in which the functions are executed. Defaults to the Element's DOM element.\r
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the functions are executed. Defaults to the Element's DOM element.\r
      * @param {Object} options (optional) Options for the listener. See {@link Ext.util.Observable#addListener the <tt>options</tt> parameter}.\r
      * @return {Ext.Element} this\r
      */\r
@@ -695,7 +711,9 @@ el.un('click', this.handlerFn);
     * @return {Ext.Element} this\r
      */\r
     update : function(html) {\r
-        this.dom.innerHTML = html;\r
+        if (this.dom) {\r
+            this.dom.innerHTML = html;\r
+        }\r
         return this;\r
     }\r
 };\r
@@ -708,9 +726,9 @@ El.addMethods = function(o){
 \r
 <div id="method-Ext.Element-on"></div>/**\r
  * Appends an event handler (shorthand for {@link #addListener}).\r
- * @param {String} eventName The type of event to handle\r
- * @param {Function} fn The handler function the event invokes\r
- * @param {Object} scope (optional) The scope (this element) of the handler function\r
+ * @param {String} eventName The name of event to handle.\r
+ * @param {Function} fn The handler function the event invokes.\r
+ * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function is executed.\r
  * @param {Object} options (optional) An object containing standard {@link #addListener} options\r
  * @member Ext.Element\r
  * @method on\r
@@ -719,10 +737,10 @@ ep.on = ep.addListener;
 \r
 <div id="method-Ext.Element-un"></div>/**\r
  * Removes an event handler from this element (see {@link #removeListener} for additional notes).\r
- * @param {String} eventName the type of event to remove\r
- * @param {Function} fn the method the event invokes\r
- * @param {Object} scope (optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults\r
- * to this Element.\r
+ * @param {String} eventName The name of the event from which to remove the handler.\r
+ * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>\r
+ * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,\r
+ * then this must refer to the same object.\r
  * @return {Ext.Element} this\r
  * @member Ext.Element\r
  * @method un\r
@@ -815,7 +833,7 @@ El.data = function(el, key, value){
     if(arguments.length == 2){\r
         return c[key];    \r
     }else{\r
-        c[key] = value;\r
+        return (c[key] = value);\r
     }\r
 };\r
 \r
@@ -944,6 +962,6 @@ Ext.EventManager.on(window, 'unload', function(){
     delete El._flyweights;\r
 });\r
 })();\r
-</pre>    \r
-</body>\r
+</pre>
+</body>
 </html>
\ No newline at end of file