Fix error in Safari

Caused by using .children instead of .childNodes
on an HTMLElement