fix safari and chrome compatibility

on safari and chrome you have to use pathSegList.getItem() instead of
treating the list like an array.