76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass(function(Y) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // TODO: unit-less lineHeight (e.g. 1.22)
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass re_unit = /^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (property === OPACITY && Y.DOM.CUSTOM_STYLES[OPACITY]) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else if (!current || (current.indexOf && current.indexOf(PX) > -1)) { // no need to convert
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else if (Y.DOM.IE.COMPUTED[property]) { // use compute function
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value = Y.DOM.IE.COMPUTED[property](el, property);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else if (re_unit.test(current)) { // convert to pixel
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value = ComputedStyle.getPixel(el, property) + PX;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass var current = _getStyleObj(el)[prop], // value of "width", "top", etc.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass capped = prop.charAt(0).toUpperCase() + prop.substr(1), // "Width", "Top", etc.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass offset = 'offset' + capped, // "offsetWidth", "offsetTop", etc.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass pixel = 'pixel' + capped, // "pixelWidth", "pixelTop", etc.
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // IE pixelWidth incorrect for percent
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // manually compute by subtracting padding and border from offset size
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // NOTE: clientWidth/Height (size minus border) is 0 when current === AUTO so offsetHeight is used
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // reverting to auto from auto causes position stacking issues (old impl)
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (current === AUTO || current.indexOf('%') > -1) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value -= ComputedStyle.getPixel(el, 'padding' + sizeOffsets[0]);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value -= ComputedStyle.getBorderWidth(el, 'border' + sizeOffsets[0] + 'Width', 1);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value -= ComputedStyle.getPixel(el, 'padding' + sizeOffsets[1]);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass value -= ComputedStyle.getBorderWidth(el, 'border' + sizeOffsets[1] + 'Width', 1);
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else { // use style.pixelWidth, etc. to convert to pixels
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // need to map style.width to currentStyle (no currentStyle.pixelWidth)
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass getBorderWidth: function(el, property, omitUnit) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (current.indexOf(PX) < 0) { // look up keywords if a border exists
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } else { // otherwise no border (default is "medium")
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass return (omitUnit) ? parseFloat(current) : current;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // use pixelRight to convert to px
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass var val = null,
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass while ( (current = node.currentStyle) && current[att] == 'inherit') { // NOTE: assignment in test
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.DOM.elementByAxis(node, 'parentNode', null, function(parent) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass return true;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass //fontSize: getPixelFont,
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass test: function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass test: function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass test: function() {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass// use alpha filter for IE opacity
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glassif (!testFeature('style', 'opacity') && testFeature('style', 'filter')) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass try { // will error if no DXImageTransform
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass val = node[FILTERS]['DXImageTransform.Microsoft.Alpha'][OPACITY];
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass } catch(e) {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass try { // make sure its in the document
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.log('getStyle: IE opacity filter not found; returning 1', 'warn', 'dom-style');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (val === '') { // normalize inline style behavior
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass current = (OPACITY in styleObj) ? styleObj[OPACITY] : 1; // revert to original opacity
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (typeof currentFilter == 'string') { // in case not appended
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass style[FILTER] = currentFilter.replace(/alpha([^)]*\))/gi, '') +
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass ((val < 1) ? 'alpha(' + OPACITY + '=' + val * 100 + ')' : '');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.config.doc.createElement('div').style.height = '-1px';
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass} catch(e) { // IE throws error on invalid style set; trap common cases
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (floatVal >= 0 || val === 'auto' || val === '') {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.log('invalid style value for height: ' + val, 'warn', 'dom-style');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass if (floatVal >= 0 || val === 'auto' || val === '') {
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass Y.log('invalid style value for width: ' + val, 'warn', 'dom-style');
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass // TODO: top, right, bottom, left
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed[WIDTH] = IEComputed[HEIGHT] = ComputedStyle.getOffset;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed.color = IEComputed.backgroundColor = ComputedStyle.getColor;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed[BORDER_WIDTH] = IEComputed[BORDER_TOP_WIDTH] = IEComputed[BORDER_RIGHT_WIDTH] =
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed[BORDER_BOTTOM_WIDTH] = IEComputed[BORDER_LEFT_WIDTH] =
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed.marginTop = IEComputed.marginRight = IEComputed.marginBottom =
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed.visibility = ComputedStyle.getVisibility;
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed.borderColor = IEComputed.borderTopColor =
76ca635d61eb3f9fb7c9d788a44fa8b1690aa138Dav Glass IEComputed.borderRightColor = IEComputed.borderBottomColor =