Skip to content

Commit

Permalink
Merge pull request #5127 from alphagov/bk-remove-polyfill-links
Browse files Browse the repository at this point in the history
Remove direct links to Polyfill[dot]io
  • Loading branch information
domoscargin authored Jul 12, 2024
2 parents 22a4429 + ee08d85 commit 2e108a2
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 30 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

### Fixes

We’ve made fixes to GOV.UK Frontend in the following pull requests:

- [#5127: Remove direct links to Polyfill[dot]io](https://github.com/alphagov/govuk-frontend/pull/5127)

## GOV.UK Frontend v4.8.0 (Feature release)

This release includes the ability to update the crown logo. You must do this between 19 February and 1 March 2024.
Expand Down
7 changes: 7 additions & 0 deletions src/govuk/vendor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# NOTE

These polyfills were generated using polyfill.io, which was reported as compromised on 25th June 2024.

We generated this code well before the compromise, and it is free of malicious code.

However, we recommend checking any polyfills you have generated in a similar way.
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/DOMTokenList.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
var detect = (
'DOMTokenList' in this && (function (x) {
return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;
Expand All @@ -10,7 +9,6 @@

if (detect) return

// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/polyfill.js
(function (global) {
var nativeImpl = "DOMTokenList" in global && global.DOMTokenList;

Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Date/now.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://github.com/Financial-Times/polyfill-library/blob/v3.111.0/polyfills/Date/now/detect.js
var detect = ('Date' in self && 'now' in self.Date && 'getTime' in self.Date.prototype)

if (detect) return

// Polyfill from https://polyfill.io/v3/polyfill.js?version=3.111.0&features=Date.now&flags=always
Date.now = function () {
return new Date().getTime();
};
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Document.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
var detect = ("Document" in this)

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {

if (this.HTMLDocument) { // IE8
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Element.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import './Document.mjs'

(function(undefined) {

// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
var detect = ('Element' in this && 'HTMLElement' in this)

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
(function () {

// IE8
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Element/prototype/classList.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import '../../Element.mjs'

(function(undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
var detect = (
'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
var e = document.createElement('span');
Expand All @@ -16,7 +15,6 @@ import '../../Element.mjs'

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
(function (global) {
var dpSupport = true;
var defineGetter = function (object, name, fn, configurable) {
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Element/prototype/closest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import './matches.mjs'

(function(undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/closest/detect.js
var detect = (
'document' in this && "closest" in document.documentElement
)

if (detect) return

// 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;

Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Element/prototype/dataset.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import '../../Element.mjs'

(function(undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/detect.js
var detect = (function(){
if (!document.documentElement.dataset) {
return false;
Expand All @@ -16,7 +15,6 @@ import '../../Element.mjs'

if (detect) return

// Polyfill derived from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/polyfill.js
Object.defineProperty(Element.prototype, 'dataset', {
get: function() {
var element = this;
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Element/prototype/matches.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/detect.js
var detect = (
'document' in this && "matches" in document.documentElement
)

if (detect) return

// Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/1f3c09b402f65bf6e393f933a15ba63f1b86ef1f/packages/polyfill-library/polyfills/Element/prototype/matches/polyfill.js
Element.prototype.matches = Element.prototype.webkitMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || function matches(selector) {
var element = this;
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import '../../Element.mjs'

(function(undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/nextElementSibling/detect.js
var detect = (
'document' in this && "nextElementSibling" in document.documentElement
)

if (detect) return

// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import '../../Element.mjs'

(function(undefined) {

// Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/master/polyfills/Element/prototype/previousElementSibling/detect.js
var detect = (
'document' in this && "previousElementSibling" in document.documentElement
)

if (detect) return

// 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;
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import './Object/defineProperty.mjs'

(function(undefined) {

// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Event/detect.js
var detect = (
(function(global) {

Expand All @@ -25,7 +24,6 @@ var detect = (

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Event&flags=always
(function () {
var unlistenableWindowEvents = {
click: 1,
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Function/prototype/bind.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
import '../../Object/defineProperty.mjs'

(function(undefined) {
// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
var detect = 'bind' in Function.prototype

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Function.prototype.bind&flags=always
Object.defineProperty(Function.prototype, 'bind', {
value: function bind(that) { // .length is 1
// add necessary es5-shim utilities
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Object/defineProperty.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
var detect = (
// In IE8, defineProperty could only act on DOM elements, so full support
// for the feature requires the ability to set a property on an arbitrary object
Expand All @@ -18,7 +17,6 @@ var detect = (

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
(function (nativeDefineProperty) {

var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/String/prototype/trim.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
var detect = ('trim' in String.prototype)

if (detect) return

// Polyfill from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
Expand Down
2 changes: 0 additions & 2 deletions src/govuk/vendor/polyfills/Window.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// @ts-nocheck
(function (undefined) {

// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
var detect = ('Window' in this)

if (detect) return

// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Window&flags=always
if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
(function (global) {
if (global.constructor) {
Expand Down

0 comments on commit 2e108a2

Please sign in to comment.