This was in code before we just move moved to scripts block. But I'm pretty sure that this logic was somewhere before and I don't know what causes that. @seanlinsley  @zwn 
Anyway I think this is just bad. Mostly because we shouldn't have js code triggering based on template rendering but because of js logic.