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 js error causing missing accordions in IE7 #407

Merged
merged 1 commit into from
May 3, 2017
Merged

Conversation

36degrees
Copy link
Contributor

Accessing individual characters in strings as if they are arrays is an ECMAScript 5 feature which was only introduced in IE8. So IE 7 and below (and IE11 when in compatibility mode) are erroring because of this.

Notably this is leaving accordions in a state where the original page content has been removed (because they use the js-hidden class), but the accordion fails to initialise, leaving the user with no way to navigate further.

We can fix this by using charAt1 as recommended by MDN 2

Accessing individual characters in strings as if they are arrays is an ECMAScript 5 feature which was only introduced in IE8. So IE 7 and below (and IE11 when in compatibility mode) are erroring because of this.

Notably this is leaving accordions in a state where the original page content has been removed (because they use the js-hidden class), but the accordion fails to initialise, leaving the user with no way to navigate further.

We can fix this by using `charAt`[1] as recommended by MDN [2]

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charAt
[2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#Character_access
@gemmaleigh gemmaleigh merged commit c2be64c into master May 3, 2017
@gemmaleigh gemmaleigh deleted the fix-ie7-errors branch May 3, 2017 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants