// ##### Main JavaScript ##### //

$(document).ready(function(){
  
  // ***** Facets ***** //

  $('.js-facet__deselect-all-button').hide();

  $('.js-facet__select-all-button').click(function(){
    $('.js-facet__check-input').prop('checked', true);
    $('.js-facet__select-all-button').hide();
    $('.js-facet__deselect-all-button').show();
  });

  $('.js-facet__deselect-all-button').click(function(){
    $('.js-facet__check-input').prop('checked', false);
    $('.js-facet__select-all-button').show();
    $('.js-facet__deselect-all-button').hide();
  });

  $('.js-facet__check-input').click(function(){
    $('.js-facet__select-all-button').hide();
    $('.js-facet__deselect-all-button').show();
  });

}); // Close $(document).ready(function()

// ***** Details Element ***** //

if (Modernizr.details) {

  // Details element supported:

  $('.o-showhide').attr('aria-expanded', 'false');

  if ($('.o-showhide').is('[open]')) {
    $('[open]').attr('aria-expanded', 'true');
  }

  $('.o-showhide__summary').click(function(){
    if ($(this).parent().is('[open]')) {
      $(this).parent().attr('aria-expanded', 'false');
    } else {
      $(this).parent().attr('aria-expanded', 'true');
    }
  });

} else {

  // Details element not supported:

  $('.o-showhide__summary').siblings().hide();
  $('.o-showhide').attr('aria-expanded', 'false');
  
  if ($('.o-showhide').is('[open]')) {
    $('[open]').children().show();
    $('[open]').attr('aria-expanded', 'true');
  }

  $('.o-showhide__summary').click(function(){
    $(this).siblings().toggle();

    if ($(this).parent().is('[open]')) {
      $(this).parent().removeAttr('open');
      $(this).parent().attr('aria-expanded', 'false');
    } else {
      $(this).parent().attr('open', '');
      $(this).parent().attr('aria-expanded', 'true');
    }
  });
}

@@ -846,35 +846,31 @@
 rted:%0A%0A  $('
-.o-showhide
+details
 ').attr('ari
@@ -898,35 +898,31 @@
 ;%0A%0A  if ($('
-.o-showhide
+details
 ').is('%5Bopen
@@ -981,37 +981,24 @@
 ;%0A  %7D%0A%0A  $('
-.o-showhide__
 summary').cl
@@ -1237,37 +1237,24 @@
 rted:%0A%0A  $('
-.o-showhide__
 summary').si
@@ -1275,27 +1275,23 @@
 );%0A  $('
-.o-showhide
+details
 ').attr(
@@ -1329,27 +1329,23 @@
  if ($('
-.o-showhide
+details
 ').is('%5B
@@ -1451,21 +1451,8 @@
  $('
-.o-showhide__
 summ

replace details polyfill classes with type selectors