diff --git a/CHANGELOG.md b/CHANGELOG.md index 86882535fb..bf851ce0f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Fixes +- [Pull request #1745: Update vendor polyfills to match upstream](https://github.com/alphagov/govuk-frontend/pull/1745). - [Pull request #1724: Fix fallback logo being detected by Google Chrome's image description feature](https://github.com/alphagov/govuk-frontend/pull/1724). ## 3.5.0 (Feature release) diff --git a/src/govuk/vendor/polyfills/Element/prototype/closest.js b/src/govuk/vendor/polyfills/Element/prototype/closest.js index 6ed55020fb..45d193e108 100644 --- a/src/govuk/vendor/polyfills/Element/prototype/closest.js +++ b/src/govuk/vendor/polyfills/Element/prototype/closest.js @@ -9,7 +9,7 @@ import './matches' if (detect) return - // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js + // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/polyfill.js Element.prototype.closest = function closest(selector) { var node = this; diff --git a/src/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js b/src/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js index 2265654089..72ff79caa7 100644 --- a/src/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +++ b/src/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js @@ -3,26 +3,20 @@ import '../../Element' (function(undefined) { - // Detection from https://github.com/Financial-Times/polyfill-service/pull/1062/files#diff-b09a5d2acf3314b46a6c8f8d0c31b85c + // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/nextElementSibling/detect.js var detect = ( - 'Element' in this && "nextElementSibling" in document.documentElement + 'document' in this && "nextElementSibling" in document.documentElement ) if (detect) return - - (function (global) { - - // There is no polyfill in polyfill-library (https://github.com/Financial-Times/polyfill-library/issues/338) - // So we source this from https://github.com/Alhadis/Snippets/blob/e09b4dfb7ffc9e250bc28319051e39ead3e5f70a/js/polyfills/IE8-child-elements.js#L28-L33 - Object.defineProperty(Element.prototype, "nextElementSibling", { - get: function(){ - var el = this.nextSibling; - while (el && el.nodeType !== 1) { el = el.nextSibling; } - return el; - } - }); - - }(this)); + // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/nextElementSibling/polyfill.js + Object.defineProperty(Element.prototype, "nextElementSibling", { + get: function(){ + var el = this.nextSibling; + while (el && el.nodeType !== 1) { el = el.nextSibling; } + return el; + } + }); }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {}); diff --git a/src/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js b/src/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js index a499550551..daeef5ff60 100644 --- a/src/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +++ b/src/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js @@ -3,24 +3,20 @@ import '../../Element' (function(undefined) { - // Detection from https://github.com/Financial-Times/polyfill-service/pull/1062/files#diff-a162235fbc9c0dd40d4032265f44942e + // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/previousElementSibling/detect.js var detect = ( - 'Element' in this && 'previousElementSibling' in document.documentElement + 'document' in this && "previousElementSibling" in document.documentElement ) if (detect) return - (function (global) { - // There is no polyfill in polyfill-library (https://github.com/Financial-Times/polyfill-library/issues/338) - // So we source this from https://github.com/Alhadis/Snippets/blob/e09b4dfb7ffc9e250bc28319051e39ead3e5f70a/js/polyfills/IE8-child-elements.js#L35-L40 - Object.defineProperty(Element.prototype, 'previousElementSibling', { - get: function(){ - var el = this.previousSibling; - while (el && el.nodeType !== 1) { el = el.previousSibling; } - return el; - } - }); - - }(this)); + // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/previousElementSibling/polyfill.js + Object.defineProperty(Element.prototype, 'previousElementSibling', { + get: function(){ + var el = this.previousSibling; + while (el && el.nodeType !== 1) { el = el.previousSibling; } + return el; + } + }); }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});