refactored

- put everything into is_javascript function, allowing early return,
which also means slices don't need to live long, so less to_string()!
- fixed wrong behavior of empty attribute
- remove util fn that was on longer being used