How do I know if a link has the "active" class?
In some cases, the active state is not set by design due potential problems with caching. This behavior is documented in this change record. 


  Setting the active class is now an opt-in feature:  
  
  l() and LinkGenerator::generate() now have a set_active_class option that defaults to FALSE
  theme_links() now accepts a set_active_class key that defaults to FALSE
  Those links that you'd expect to get the active class set, do get it: menu links, language switching links …
  
  The output of l(), LinkGenerator::generate() and theme_links() no longer contains the active class, even if you do opt in. Instead, they get a data-drupal-link-system-path attribute, and if there's a GET query, they also get a data-drupal-link-query attribute…


In those cases, where it is not set on server side, you can take a look at core/misc/active-link.js to get an idea how to manipulate the active state on client side.