From 41e6ef28b03b8bf7b21a3fab7f50f4adbca343e7 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Mon, 25 Jun 2018 12:18:30 +0100 Subject: [PATCH] Removed unneeded compatibility shim for getComputedStyle(). Required for IE<9. --- .../static/admin/js/admin/DateTimeShortcuts.js | 6 +++--- django/contrib/admin/static/admin/js/core.js | 17 ----------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js index 08b2785c06..1d9fbdaa77 100644 --- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js @@ -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: // // @@ -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 { diff --git a/django/contrib/admin/static/admin/js/core.js b/django/contrib/admin/static/admin/js/core.js index 591394e551..37e3b85551 100644 --- a/django/contrib/admin/static/admin/js/core.js +++ b/django/contrib/admin/static/admin/js/core.js @@ -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; -}