dom-style.js revision 01da5a7676654f1e0bfac7eaaca697949de8472f
(function(Y) {
/**
* Add style management functionality to DOM.
* @module dom
* @submodule dom-style
* @for DOM
*/
var DOCUMENT_ELEMENT = 'documentElement',
DEFAULT_VIEW = 'defaultView',
OWNER_DOCUMENT = 'ownerDocument',
STYLE = 'style',
FLOAT = 'float',
CSS_FLOAT = 'cssFloat',
STYLE_FLOAT = 'styleFloat',
TRANSPARENT = 'transparent',
GET_COMPUTED_STYLE = 'getComputedStyle',
DEFAULT_UNIT: 'px',
},
/**
* Sets a style property for a given element.
* @method setStyle
* @param {HTMLElement} An HTMLElement to apply the style to.
* @param {String} att The style property to set.
* @param {String|Number} val The value.
*/
if (style) {
val = '';
}
if (att in CUSTOM_STYLES) {
return; // NOTE: return
}
}
}
},
/**
* Returns the current style value for the given property.
* @method getStyle
* @param {HTMLElement} An HTMLElement to get the style from.
* @param {String} att The style property to get.
*/
val = '';
if (style) {
if (att in CUSTOM_STYLES) {
}
}
}
}
return val;
},
/**
* Sets multiple style properties.
* @method setStyles
* @param {HTMLElement} node An HTMLElement to apply the styles to.
* @param {Object} hash An object literal of property:value pairs.
*/
}, Y_DOM);
},
/**
* Returns the computed style for the given node.
* @method getComputedStyle
* @param {HTMLElement} An HTMLElement to get the style from.
* @param {String} att The style property to get.
* @return {String} The computed value of the style property.
*/
var val = '',
}
return val;
}
});
// normalize reserved word float alternatives ("cssFloat" or "styleFloat")
}
// fix opera computedStyle default color unit (convert to rgb)
}
return val;
};
}
// safari converts transparent to rgba(), others use "transparent"
if (val === 'rgba(0, 0, 0, 0)') {
val = TRANSPARENT;
}
return val;
};
}
})(Y);
(function(Y) {
RE = RegExp;
Y.Color = {
KEYWORDS: {
black: '000',
silver: 'c0c0c0',
gray: '808080',
white: 'fff',
maroon: '800000',
red: 'f00',
purple: '800080',
fuchsia: 'f0f',
green: '008000',
lime: '0f0',
olive: '808000',
yellow: 'ff0',
navy: '000080',
blue: '00f',
teal: '008080',
aqua: '0ff'
},
}
val = 'rgb(' + [
}
return val;
},
val = [
];
}
}
}
}
}
return val.toUpperCase();
}
};
})(Y);
(function(Y) {
var HAS_LAYOUT = 'hasLayout',
PX = 'px',
FILTER = 'filter',
FILTERS = 'filters',
OPACITY = 'opacity',
AUTO = 'auto',
BORDER_WIDTH = 'borderWidth',
BORDER_TOP_WIDTH = 'borderTopWidth',
BORDER_RIGHT_WIDTH = 'borderRightWidth',
BORDER_BOTTOM_WIDTH = 'borderBottomWidth',
BORDER_LEFT_WIDTH = 'borderLeftWidth',
WIDTH = 'width',
HEIGHT = 'height',
TRANSPARENT = 'transparent',
VISIBLE = 'visible',
GET_COMPUTED_STYLE = 'getComputedStyle',
// TODO: unit-less lineHeight (e.g. 1.22)
_getStyleObj = function(node) {
},
ComputedStyle = {
CUSTOM_STYLES: {},
var value = '',
if (el) {
} else {
}
}
return value;
},
sizeOffsets: {
top: ['Top'],
bottom: ['Bottom']
},
value = '';
// IE pixelWidth incorrect for percent
// manually compute by subtracting padding and border from offset size
// NOTE: clientWidth/Height (size minus border) is 0 when current === AUTO so offsetHeight is used
// reverting to auto from auto causes position stacking issues (old impl)
if (sizeOffsets[0]) {
}
if (sizeOffsets[1]) {
}
} else { // use style.pixelWidth, etc. to convert to pixels
// need to map style.width to currentStyle (no currentStyle.pixelWidth)
}
}
},
borderMap: {
thin: '2px',
medium: '4px',
thick: '6px'
},
} else { // otherwise no border (default is "medium")
current = 0;
}
}
},
// use pixelRight to convert to px
var val = null,
return val;
},
var val,
val = 0;
} else {
}
},
var current;
}
},
return true;
}
});
}
},
}
},
//fontSize: getPixelFont,
IEComputed = {};
// use alpha filter for IE opacity
try {
var val = 100;
try { // will error if no DXImageTransform
} catch(e) {
try { // make sure its in the document
} catch(err) {
}
}
return val / 100;
},
var current,
}
}
}
}
};
}
} catch(e) {
}
try {
} catch(e) { // IE throws error on invalid style set; trap common cases
} else {
}
}
};
} else {
}
}
};
}
// TODO: top, right, bottom, left
}
Y.namespace('DOM.IE');
})(Y);
/**
* Sets the width of the element to the given size, regardless
* of box model, border, padding, etc.
* @method setWidth
* @param {HTMLElement} element The DOM element.
* @param {String|Int} size The pixel height to size to
*/
},
/**
* Sets the height of the element to the given size, regardless
* of box model, border, padding, etc.
* @method setHeight
* @param {HTMLElement} element The DOM element.
* @param {String|Int} size The pixel height to size to
*/
},
},
var offset;
if (val < 0) {
}
}
});