3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
4 <title>The source code</title>
\r
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
8 <body onload="prettyPrint();">
\r
9 <pre class="prettyprint lang-js">/**
\r
10 * @class Ext.Element
\r
12 Ext.Element.addMethods(
\r
14 var VISIBILITY = "visibility",
\r
15 DISPLAY = "display",
\r
18 XMASKED = "x-masked",
\r
19 XMASKEDRELATIVE = "x-masked-relative",
\r
20 data = Ext.Element.data;
\r
23 <div id="method-Ext.Element-isVisible"></div>/**
\r
24 * Checks whether the element is currently visible using both visibility and display properties.
\r
25 * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
\r
26 * @return {Boolean} True if the element is currently visible, else false
\r
28 isVisible : function(deep) {
\r
29 var vis = !this.isStyle(VISIBILITY,HIDDEN) && !this.isStyle(DISPLAY,NONE),
\r
30 p = this.dom.parentNode;
\r
31 if(deep !== true || !vis){
\r
34 while(p && !/^body/i.test(p.tagName)){
\r
35 if(!Ext.fly(p, '_isVisible').isVisible()){
\r
43 <div id="method-Ext.Element-isDisplayed"></div>/**
\r
44 * Returns true if display is not "none"
\r
47 isDisplayed : function() {
\r
48 return !this.isStyle(DISPLAY, NONE);
\r
51 <div id="method-Ext.Element-enableDisplayMode"></div>/**
\r
52 * Convenience method for setVisibilityMode(Element.DISPLAY)
\r
53 * @param {String} display (optional) What to set display to when visible
\r
54 * @return {Ext.Element} this
\r
56 enableDisplayMode : function(display){
\r
57 this.setVisibilityMode(Ext.Element.DISPLAY);
\r
58 if(!Ext.isEmpty(display)){
\r
59 data(this.dom, 'originalDisplay', display);
\r
64 <div id="method-Ext.Element-mask"></div>/**
\r
65 * Puts a mask over this element to disable user interaction. Requires core.css.
\r
66 * This method can only be applied to elements which accept child nodes.
\r
67 * @param {String} msg (optional) A message to display in the mask
\r
68 * @param {String} msgCls (optional) A css class to apply to the msg element
\r
69 * @return {Element} The mask element
\r
71 mask : function(msg, msgCls){
\r
75 EXTELMASKMSG = "ext-el-mask-msg",
\r
79 if(me.getStyle("position") == "static"){
\r
80 me.addClass(XMASKEDRELATIVE);
\r
82 if((el = data(dom, 'maskMsg'))){
\r
85 if((el = data(dom, 'mask'))){
\r
89 mask = dh.append(dom, {cls : "ext-el-mask"}, true);
\r
90 data(dom, 'mask', mask);
\r
92 me.addClass(XMASKED);
\r
93 mask.setDisplayed(true);
\r
94 if(typeof msg == 'string'){
\r
95 var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);
\r
96 data(dom, 'maskMsg', mm);
\r
97 mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;
\r
98 mm.dom.firstChild.innerHTML = msg;
\r
99 mm.setDisplayed(true);
\r
102 if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto'){ // ie will not expand full height automatically
\r
103 mask.setSize(undefined, me.getHeight());
\r
108 <div id="method-Ext.Element-unmask"></div>/**
\r
109 * Removes a previously applied mask.
\r
111 unmask : function(){
\r
114 mask = data(dom, 'mask'),
\r
115 maskMsg = data(dom, 'maskMsg');
\r
119 data(dom, 'maskMsg', undefined);
\r
122 data(dom, 'mask', undefined);
\r
124 me.removeClass([XMASKED, XMASKEDRELATIVE]);
\r
127 <div id="method-Ext.Element-isMasked"></div>/**
\r
128 * Returns true if this element is masked
\r
129 * @return {Boolean}
\r
131 isMasked : function(){
\r
132 var m = data(this.dom, 'mask');
\r
133 return m && m.isVisible();
\r
136 <div id="method-Ext.Element-createShim"></div>/**
\r
137 * Creates an iframe shim for this element to keep selects and other windowed objects from
\r
139 * @return {Ext.Element} The new shim element
\r
141 createShim : function(){
\r
142 var el = document.createElement('iframe'),
\r
144 el.frameBorder = '0';
\r
145 el.className = 'ext-shim';
\r
146 el.src = Ext.SSL_SECURE_URL;
\r
147 shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));
\r
148 shim.autoBoxAdjust = false;
\r