Optimize addEventListener and removeEventListener to only feature-detect once