Unfortunately I can’t because my page is generated at runtime and I don’t know which kind of elements are in that page.

Anyway I did it in a simple testcase I created and it doesn’t change the page building time.

On the other hand the js file are cached and the loading time of the js doesn’t seem to be a problem.