Please don't call `filter.indexOf()` twice. Either save the index with a local variable, or you might want to use a regex instead to extract the CSS selector.