Skip to content

Commit

Permalink
Removed the need for JSON parsing to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
KittyGiraudel committed Mar 11, 2016
1 parent a34d33d commit d835cc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion a11y-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
document.addEventListener('click', function (event) {
var toggle = event.target;
var target = targetsMap[toggle.getAttribute(namespace)];
var isExpanded = JSON.parse(toggle.getAttribute('aria-expanded'));
var isExpanded = toggle.getAttribute('aria-expanded') === 'true';

if (target) {
toggle.setAttribute('aria-expanded', !isExpanded);
Expand Down
2 changes: 1 addition & 1 deletion a11y-toggle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
document.addEventListener('click', function (event) {
var toggle = event.target;
var target = targetsMap[toggle.getAttribute(namespace)];
var isExpanded = JSON.parse(toggle.getAttribute('aria-expanded'));
var isExpanded = toggle.getAttribute('aria-expanded') === 'true';

if (target) {
toggle.setAttribute('aria-expanded', !isExpanded);
Expand Down

0 comments on commit d835cc9

Please sign in to comment.