Removed unneeded compatibility shim for getComputedStyle().

Required for IE<9.
This commit is contained in:
Nick Pope 2018-06-25 12:18:30 +01:00 committed by Tim Graham
parent 2a431db0f5
commit 41e6ef28b0
2 changed files with 3 additions and 20 deletions

View File

@ -1,4 +1,4 @@
/*global Calendar, findPosX, findPosY, getStyle, get_format, gettext, gettext_noop, interpolate, ngettext, quickElement*/
/*global Calendar, findPosX, findPosY, get_format, gettext, gettext_noop, interpolate, ngettext, quickElement*/
// Inserts shortcut buttons after all of the following:
// <input type="text" class="vDateField">
// <input type="text" class="vTimeField">
@ -197,7 +197,7 @@
// Recalculate the clockbox position
// is it left-to-right or right-to-left layout ?
if (getStyle(document.body, 'direction') !== 'rtl') {
if (window.getComputedStyle(document.body).direction !== 'rtl') {
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
}
else {
@ -370,7 +370,7 @@
// Recalculate the clockbox position
// is it left-to-right or right-to-left layout ?
if (getStyle(document.body, 'direction') !== 'rtl') {
if (window.getComputedStyle(document.body).direction !== 'rtl') {
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
}
else {

View File

@ -193,20 +193,3 @@ function findPosY(obj) {
};
})();
// ----------------------------------------------------------------------------
// Get the computed style for and element
// ----------------------------------------------------------------------------
function getStyle(oElm, strCssRule) {
'use strict';
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle) {
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
}
else if(oElm.currentStyle) {
strCssRule = strCssRule.replace(/\-(\w)/g, function(strMatch, p1) {
return p1.toUpperCase();
});
strValue = oElm.currentStyle[strCssRule];
}
return strValue;
}