Whenever you create HTML using EJS, the string of HTML has to be converted into an document fragment. Deep inside jQuery, this is done (eventually) using the innerHTML function. innerHTML will completely barf on table elements unless the HTML string is a properly nested table structure.
Try this:
- var d = document.createElement('div');
- d.innerHTML = '<tr><td>Hi!</td></tr>';
- console.log(d.innerHTML) //-> Output: Hi!
So what we do is make sure that any HTML string with table elements has a complete table structure before passing it to jQuery. Then we extract out the HTML you originally wanted.
- d = document.createElement('div')
- //detect HTML elements, add full structure to it
- d.innerHTML = '<table><tbody><tr><td>Hi!</td></tr></tbody></table>'
- console.log(d.firstChild.firstChild.firstChild)
Looks like that is not happening properly. Can you create a fiddle of this behavior and then create an issue on the CanJS GitHub page?