Fix attaching event handlers to repeated elements, extend functionality a bit

- Repeat now re-uses the existing DOM parent element instead of
replacing the to-be-repeated item with a DIV. This allows us to e.g.
repeat a <tr> inside a <table>

- After creating the repeated elements, attach event handlers to these
new elements so that changes are propagated automatically.

- Added the possibility to dynamically evaluate JS inside a repeating
element, syntax: $${code}, e.g. $${key + 1} will render the list items
1, 2, .. (To make calculation easier I'm now converting the array 'key'
(index) to an int)