* @type String
*/
defaultUnit : "px",
+
/**
* Sets the element's visibility mode. When setVisible() is called it
* will use this to determine whether to set the visibility or the display property.
*/
enableDisplayMode : function(display){
this.setVisibilityMode(El.DISPLAY);
- if(typeof display != "undefined") this.originalDisplay = display;
+ if(typeof display != "undefined") { this.originalDisplay = display; }
return this;
},
var p = Roo.fly(this.dom.parentNode, '_internal');
return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
},
+
+ /**
+ * Looks at the scrollable parent element
+ */
+ findScrollableParent : function()
+ {
+ var overflowRegex = /(auto|scroll)/;
+
+ if(this.getStyle('position') === 'fixed'){
+ return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+ }
+
+ var excludeStaticParent = this.getStyle('position') === "absolute";
+
+ for (var parent = this; (parent = Roo.get(parent.dom.parentNode));){
+
+ if (excludeStaticParent && parent.getStyle('position') === "static") {
+ continue;
+ }
+
+ if (overflowRegex.test(parent.getStyle('overflow') + parent.getStyle('overflow-x') + parent.getStyle('overflow-y'))){
+ return parent;
+ }
+
+ if(parent.dom.nodeName.toLowerCase() == 'body'){
+ return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+ }
+ }
+
+ return Roo.isAndroid ? Roo.get(document.documentElement) : Roo.get(document.body);
+ },
/**
* Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
this.setHeight(oldHeight); // restore original height
this.setHeight(height, animate, duration, function(){
this.unclip();
- if(typeof onComplete == "function") onComplete();
+ if(typeof onComplete == "function") { onComplete(); }
}.createDelegate(this), easing);
}
}.createDelegate(this), 0);
*/
mask : function(msg, msgCls)
{
- if(this.getStyle("position") == "static"){
+ if(this.getStyle("position") == "static" && this.dom.tagName !== 'BODY'){
this.setStyle("position", "relative");
}
if(!this._mask){
this._mask = Roo.DomHelper.append(this.dom, {cls:"roo-el-mask"}, true);
}
+
this.addClass("x-masked");
this._mask.setDisplayed(true);
// we wander
var z = 0;
- var dom = this.dom
- while (dom) {
+ var dom = this.dom;
+ while (dom && dom.style) {
if (!isNaN(parseInt(dom.style.zIndex))) {
z = Math.max(z, parseInt(dom.style.zIndex));
}
dom = dom.parentNode;
}
-
+ // if we are masking the body - then it hides everything..
+ if (this.dom == document.body) {
+ z = 1000000;
+ this._mask.setWidth(Roo.lib.Dom.getDocumentWidth());
+ this._mask.setHeight(Roo.lib.Dom.getDocumentHeight());
+ }
if(typeof msg == 'string'){
if(!this._maskMsg){
- this._maskMsg = Roo.DomHelper.append(this.dom, {cls:"roo-el-mask-msg", cn:{tag:'div'}}, true);
+ this._maskMsg = Roo.DomHelper.append(this.dom, {
+ cls: "roo-el-mask-msg",
+ cn: [
+ {
+ tag: 'i',
+ cls: 'fa fa-spinner fa-spin'
+ },
+ {
+ tag: 'div'
+ }
+ ]
+ }, true);
}
var mm = this._maskMsg;
mm.dom.className = msgCls ? "roo-el-mask-msg " + msgCls : "roo-el-mask-msg";
- mm.dom.firstChild.innerHTML = msg;
+ if (mm.dom.lastChild) { // weird IE issue?
+ mm.dom.lastChild.innerHTML = msg;
+ }
mm.setDisplayed(true);
mm.center(this);
mm.setStyle('z-index', z + 102);
var el = this.dom;
useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
for(var attr in o){
- if(attr == "style" || typeof o[attr] == "function") continue;
+ if(attr == "style" || typeof o[attr] == "function") { continue; }
if(attr=="cls"){
el.className = o["cls"];
}else{
- if(useSet) el.setAttribute(attr, o[attr]);
- else el[attr] = o[attr];
+ if(useSet) {
+ el.setAttribute(attr, o[attr]);
+ } else {
+ el[attr] = o[attr];
+ }
}
}
if(o.style){
} : function(ns, name){
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
+ },
+
+
+ /**
+ * Sets or Returns the value the dom attribute value
+ * @param {String|Object} name The attribute name (or object to set multiple attributes)
+ * @param {String} value (optional) The value to set the attribute to
+ * @return {String} The attribute value
+ */
+ attr : function(name){
+ if (arguments.length > 1) {
+ this.dom.setAttribute(name, arguments[1]);
+ return arguments[1];
+ }
+ if (typeof(name) == 'object') {
+ for(var i in name) {
+ this.attr(i, name[i]);
+ }
+ return name;
+ }
+
+
+ if (!this.dom.hasAttribute(name)) {
+ return undefined;
+ }
+ return this.dom.getAttribute(name);
}
+
+
+
};
var ep = El.prototype;