3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.0
11 * Copyright(c) 2006-2010 Ext JS, Inc.
13 * http://www.extjs.com/license
18 Ext.Element.addMethods(
20 var VISIBILITY = "visibility",
25 XMASKEDRELATIVE = "x-masked-relative",
26 data = Ext.Element.data;
29 <div id="method-Ext.Element-isVisible"></div>/**
30 * Checks whether the element is currently visible using both visibility and display properties.
31 * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
32 * @return {Boolean} True if the element is currently visible, else false
34 isVisible : function(deep) {
35 var vis = !this.isStyle(VISIBILITY, HIDDEN) && !this.isStyle(DISPLAY, NONE),
36 p = this.dom.parentNode;
38 if (deep !== true || !vis) {
42 while (p && !(/^body/i.test(p.tagName))) {
43 if (!Ext.fly(p, '_isVisible').isVisible()) {
51 <div id="method-Ext.Element-isDisplayed"></div>/**
52 * Returns true if display is not "none"
55 isDisplayed : function() {
56 return !this.isStyle(DISPLAY, NONE);
59 <div id="method-Ext.Element-enableDisplayMode"></div>/**
60 * Convenience method for setVisibilityMode(Element.DISPLAY)
61 * @param {String} display (optional) What to set display to when visible
62 * @return {Ext.Element} this
64 enableDisplayMode : function(display) {
65 this.setVisibilityMode(Ext.Element.DISPLAY);
67 if (!Ext.isEmpty(display)) {
68 data(this.dom, 'originalDisplay', display);
74 <div id="method-Ext.Element-mask"></div>/**
75 * Puts a mask over this element to disable user interaction. Requires core.css.
76 * This method can only be applied to elements which accept child nodes.
77 * @param {String} msg (optional) A message to display in the mask
78 * @param {String} msgCls (optional) A css class to apply to the msg element
79 * @return {Element} The mask element
81 mask : function(msg, msgCls) {
85 EXTELMASKMSG = "ext-el-mask-msg",
89 if (!(/^body/i.test(dom.tagName) && me.getStyle('position') == 'static')) {
90 me.addClass(XMASKEDRELATIVE);
92 if (el = data(dom, 'maskMsg')) {
95 if (el = data(dom, 'mask')) {
99 mask = dh.append(dom, {cls : "ext-el-mask"}, true);
100 data(dom, 'mask', mask);
102 me.addClass(XMASKED);
103 mask.setDisplayed(true);
105 if (typeof msg == 'string') {
106 var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
107 data(dom, 'maskMsg', mm);
108 mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;
109 mm.dom.firstChild.innerHTML = msg;
110 mm.setDisplayed(true);
114 // ie will not expand full height automatically
115 if (Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto') {
116 mask.setSize(undefined, me.getHeight());
122 <div id="method-Ext.Element-unmask"></div>/**
123 * Removes a previously applied mask.
125 unmask : function() {
128 mask = data(dom, 'mask'),
129 maskMsg = data(dom, 'maskMsg');
134 data(dom, 'maskMsg', undefined);
138 data(dom, 'mask', undefined);
139 me.removeClass([XMASKED, XMASKEDRELATIVE]);
143 <div id="method-Ext.Element-isMasked"></div>/**
144 * Returns true if this element is masked
147 isMasked : function() {
148 var m = data(this.dom, 'mask');
149 return m && m.isVisible();
152 <div id="method-Ext.Element-createShim"></div>/**
153 * Creates an iframe shim for this element to keep selects and other windowed objects from
155 * @return {Ext.Element} The new shim element
157 createShim : function() {
158 var el = document.createElement('iframe'),
161 el.frameBorder = '0';
162 el.className = 'ext-shim';
163 el.src = Ext.SSL_SECURE_URL;
164 shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
165 shim.autoBoxAdjust = false;