Fixes IE8 compatibility and Chrome errors when using data attributes