Upgrade to ExtJS 3.3.0 - Released 10/06/2010
[extjs.git] / docs / source / Element.fx-more.html
index 6c3f733..b0497b7 100644 (file)
-<html>\r
-<head>\r
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    \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
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods(\r
-function(){\r
-    var VISIBILITY = "visibility",\r
-        DISPLAY = "display",\r
-        HIDDEN = "hidden",\r
-        NONE = "none",\r
-           XMASKED = "x-masked",\r
-               XMASKEDRELATIVE = "x-masked-relative",\r
-        data = Ext.Element.data;\r
-\r
-       return {\r
-               <div id="method-Ext.Element-isVisible"></div>/**\r
-            * Checks whether the element is currently visible using both visibility and display properties.\r
-            * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)\r
-            * @return {Boolean} True if the element is currently visible, else false\r
-            */\r
-           isVisible : function(deep) {\r
-               var vis = !this.isStyle(VISIBILITY,HIDDEN) && !this.isStyle(DISPLAY,NONE),\r
-                       p = this.dom.parentNode;\r
-               if(deep !== true || !vis){\r
-                   return vis;\r
-               }\r
-               while(p && !/^body/i.test(p.tagName)){\r
-                   if(!Ext.fly(p, '_isVisible').isVisible()){\r
-                       return false;\r
-                   }\r
-                   p = p.parentNode;\r
-               }\r
-               return true;\r
-           },\r
-\r
-           <div id="method-Ext.Element-isDisplayed"></div>/**\r
-            * Returns true if display is not "none"\r
-            * @return {Boolean}\r
-            */\r
-           isDisplayed : function() {\r
-               return !this.isStyle(DISPLAY, NONE);\r
-           },\r
-\r
-               <div id="method-Ext.Element-enableDisplayMode"></div>/**\r
-            * Convenience method for setVisibilityMode(Element.DISPLAY)\r
-            * @param {String} display (optional) What to set display to when visible\r
-            * @return {Ext.Element} this\r
-            */\r
-           enableDisplayMode : function(display){\r
-               this.setVisibilityMode(Ext.Element.DISPLAY);\r
-               if(!Ext.isEmpty(display)){\r
-                data(this.dom, 'originalDisplay', display);\r
-            }\r
-               return this;\r
-           },\r
-\r
-               <div id="method-Ext.Element-mask"></div>/**\r
-            * Puts a mask over this element to disable user interaction. Requires core.css.\r
-            * This method can only be applied to elements which accept child nodes.\r
-            * @param {String} msg (optional) A message to display in the mask\r
-            * @param {String} msgCls (optional) A css class to apply to the msg element\r
-            * @return {Element} The mask element\r
-            */\r
-           mask : function(msg, msgCls){\r
-                   var me = this,\r
-                       dom = me.dom,\r
-                       dh = Ext.DomHelper,\r
-                       EXTELMASKMSG = "ext-el-mask-msg",\r
-                el,\r
-                mask;\r
-\r
-               if(me.getStyle("position") == "static"){\r
-                   me.addClass(XMASKEDRELATIVE);\r
-               }\r
-               if((el = data(dom, 'maskMsg'))){\r
-                   el.remove();\r
-               }\r
-               if((el = data(dom, 'mask'))){\r
-                   el.remove();\r
-               }\r
-\r
-            mask = dh.append(dom, {cls : "ext-el-mask"}, true);\r
-               data(dom, 'mask', mask);\r
-\r
-               me.addClass(XMASKED);\r
-               mask.setDisplayed(true);\r
-               if(typeof msg == 'string'){\r
-                var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);\r
-                data(dom, 'maskMsg', mm);\r
-                   mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;\r
-                   mm.dom.firstChild.innerHTML = msg;\r
-                   mm.setDisplayed(true);\r
-                   mm.center(me);\r
-               }\r
-               if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto'){ // ie will not expand full height automatically\r
-                   mask.setSize(undefined, me.getHeight());\r
-               }\r
-               return mask;\r
-           },\r
-\r
-           <div id="method-Ext.Element-unmask"></div>/**\r
-            * Removes a previously applied mask.\r
-            */\r
-           unmask : function(){\r
-                   var me = this,\r
-                dom = me.dom,\r
-                       mask = data(dom, 'mask'),\r
-                       maskMsg = data(dom, 'maskMsg');\r
-               if(mask){\r
-                   if(maskMsg){\r
-                       maskMsg.remove();\r
-                    data(dom, 'maskMsg', undefined);\r
-                   }\r
-                   mask.remove();\r
-                data(dom, 'mask', undefined);\r
-               }\r
-               me.removeClass([XMASKED, XMASKEDRELATIVE]);\r
-           },\r
-\r
-           <div id="method-Ext.Element-isMasked"></div>/**\r
-            * Returns true if this element is masked\r
-            * @return {Boolean}\r
-            */\r
-           isMasked : function(){\r
-            var m = data(this.dom, 'mask');\r
-               return m && m.isVisible();\r
-           },\r
-\r
-           <div id="method-Ext.Element-createShim"></div>/**\r
-            * Creates an iframe shim for this element to keep selects and other windowed objects from\r
-            * showing through.\r
-            * @return {Ext.Element} The new shim element\r
-            */\r
-           createShim : function(){\r
-               var el = document.createElement('iframe'),\r
-                       shim;\r
-               el.frameBorder = '0';\r
-               el.className = 'ext-shim';\r
-               el.src = Ext.SSL_SECURE_URL;\r
-               shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));\r
-               shim.autoBoxAdjust = false;\r
-               return shim;\r
-           }\r
-    };\r
-}());</pre>    \r
-</body>\r
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
+  <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.3.0
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods(
+    function() {
+        var VISIBILITY      = "visibility",
+            DISPLAY         = "display",
+            HIDDEN          = "hidden",
+            NONE            = "none",
+            XMASKED         = "x-masked",
+            XMASKEDRELATIVE = "x-masked-relative",
+            data            = Ext.Element.data;
+
+        return {
+            <div id="method-Ext.Element-isVisible"></div>/**
+             * Checks whether the element is currently visible using both visibility and display properties.
+             * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
+             * @return {Boolean} True if the element is currently visible, else false
+             */
+            isVisible : function(deep) {
+                var vis = !this.isStyle(VISIBILITY, HIDDEN) && !this.isStyle(DISPLAY, NONE),
+                    p   = this.dom.parentNode;
+                
+                if (deep !== true || !vis) {
+                    return vis;
+                }
+                
+                while (p && !(/^body/i.test(p.tagName))) {
+                    if (!Ext.fly(p, '_isVisible').isVisible()) {
+                        return false;
+                    }
+                    p = p.parentNode;
+                }
+                return true;
+            },
+
+            <div id="method-Ext.Element-isDisplayed"></div>/**
+             * Returns true if display is not "none"
+             * @return {Boolean}
+             */
+            isDisplayed : function() {
+                return !this.isStyle(DISPLAY, NONE);
+            },
+
+            <div id="method-Ext.Element-enableDisplayMode"></div>/**
+             * Convenience method for setVisibilityMode(Element.DISPLAY)
+             * @param {String} display (optional) What to set display to when visible
+             * @return {Ext.Element} this
+             */
+            enableDisplayMode : function(display) {
+                this.setVisibilityMode(Ext.Element.DISPLAY);
+                
+                if (!Ext.isEmpty(display)) {
+                    data(this.dom, 'originalDisplay', display);
+                }
+                
+                return this;
+            },
+
+            <div id="method-Ext.Element-mask"></div>/**
+             * Puts a mask over this element to disable user interaction. Requires core.css.
+             * This method can only be applied to elements which accept child nodes.
+             * @param {String} msg (optional) A message to display in the mask
+             * @param {String} msgCls (optional) A css class to apply to the msg element
+             * @return {Element} The mask element
+             */
+            mask : function(msg, msgCls) {
+                var me  = this,
+                    dom = me.dom,
+                    dh  = Ext.DomHelper,
+                    EXTELMASKMSG = "ext-el-mask-msg",
+                    el,
+                    mask;
+
+                if (!(/^body/i.test(dom.tagName) && me.getStyle('position') == 'static')) {
+                    me.addClass(XMASKEDRELATIVE);
+                }
+                if (el = data(dom, 'maskMsg')) {
+                    el.remove();
+                }
+                if (el = data(dom, 'mask')) {
+                    el.remove();
+                }
+
+                mask = dh.append(dom, {cls : "ext-el-mask"}, true);
+                data(dom, 'mask', mask);
+
+                me.addClass(XMASKED);
+                mask.setDisplayed(true);
+                
+                if (typeof msg == 'string') {
+                    var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
+                    data(dom, 'maskMsg', mm);
+                    mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;
+                    mm.dom.firstChild.innerHTML = msg;
+                    mm.setDisplayed(true);
+                    mm.center(me);
+                }
+                
+                // ie will not expand full height automatically
+                if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
+                    mask.setSize(undefined, me.getHeight());
+                }
+                
+                return mask;
+            },
+
+            <div id="method-Ext.Element-unmask"></div>/**
+             * Removes a previously applied mask.
+             */
+            unmask : function() {
+                var me      = this,
+                    dom     = me.dom,
+                    mask    = data(dom, 'mask'),
+                    maskMsg = data(dom, 'maskMsg');
+
+                if (mask) {
+                    if (maskMsg) {
+                        maskMsg.remove();
+                        data(dom, 'maskMsg', undefined);
+                    }
+                    
+                    mask.remove();
+                    data(dom, 'mask', undefined);
+                    me.removeClass([XMASKED, XMASKEDRELATIVE]);
+                }
+            },
+
+            <div id="method-Ext.Element-isMasked"></div>/**
+             * Returns true if this element is masked
+             * @return {Boolean}
+             */
+            isMasked : function() {
+                var m = data(this.dom, 'mask');
+                return m && m.isVisible();
+            },
+
+            <div id="method-Ext.Element-createShim"></div>/**
+             * Creates an iframe shim for this element to keep selects and other windowed objects from
+             * showing through.
+             * @return {Ext.Element} The new shim element
+             */
+            createShim : function() {
+                var el = document.createElement('iframe'),
+                    shim;
+                
+                el.frameBorder = '0';
+                el.className = 'ext-shim';
+                el.src = Ext.SSL_SECURE_URL;
+                shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
+                shim.autoBoxAdjust = false;
+                return shim;
+            }
+        };
+    }()
+);</pre>    
+</body>
 </html>
\ No newline at end of file