Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / src / core / core / Element.js
index a57bfee..ae5f56f 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -132,7 +132,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
@@ -145,6 +145,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
+    /**\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
     /**\r
      * @event dblclick\r
      * Fires when a mouse double click is detected within the element.\r
@@ -444,11 +451,11 @@ El.prototype = {
 \r
     /**\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
@@ -562,10 +569,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
@@ -629,16 +636,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
     /**\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
@@ -694,7 +704,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
@@ -707,9 +719,9 @@ El.addMethods = function(o){
 \r
 /**\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
@@ -718,10 +730,10 @@ ep.on = ep.addListener;
 \r
 /**\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
@@ -814,7 +826,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