Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tabs component throwing JavaScript errors in Internet Explorer 8 #1678

Merged
merged 2 commits into from
Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ If you're using Nunjucks, you can now add classes to the character count compone

### Fixes

- [Pull request #1678: Fix tabs component throwing JavaScript errors in Internet Explorer 8](https://github.com/alphagov/govuk-frontend/pull/1678).
- [Pull request #1676: Fix skip link component focus style with global styles enabled](https://github.com/alphagov/govuk-frontend/pull/1676).
- [Pull request #1672: Ensure footer links look clickable](https://github.com/alphagov/govuk-frontend/pull/1672).
- [Pull request #1670: Make width-container margins more targetted to avoid specificity issues](https://github.com/alphagov/govuk-frontend/pull/1670).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import '../../Element'

(function (global) {

// Polyfill from https://github.com/Financial-Times/polyfill-service/pull/1062/files#diff-404b69b4750d18dea4174930a49170fd
// 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.nodeType === 1) ? el : null;
return el;
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import '../../Element'
if (detect) return

(function (global) {
// Polyfill from https://github.com/Financial-Times/polyfill-service/pull/1062/files#diff-b45a1197b842728cb76b624b6ba7d739
// 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.nodeType === 1) ? el : null;
return el;
}
});

Expand Down