xuijs / xui

A tiny javascript framework for mobile web apps.
http://xuijs.com
789 stars 106 forks source link

Can't dynamically create <td> elements #91

Closed quaelin closed 7 years ago

quaelin commented 10 years ago
   var
      table = xui('<table><tr></tr></table>'),
      tr = table.find('tr')
  ;
  tr.bottom('<td></td>');  // does not work

XUI seems to have issues with dynamically creating <tr> or <td> elements. Am I missing something, or is this a bug?

afryer commented 10 years ago
var
      table = xui('<table><tr></tr><tr></tr><tr></tr><tr></tr></table>'),
      tr = table.find('tr');

    tr.inner('<td>');

console.log(table.html())

Example given is malformed html as the td needs to go into the tr.

quaelin commented 10 years ago

I don't understand how my example is malformed. My understanding of tr.bottom() is exactly that it should place content inside the <tr> (specifically at the bottom), similar to how jQuery's .append() works. Is this wrong?

afryer commented 10 years ago

My understanding is that .html() and .inner() are like jQuery's .append() and .bottom() would place the element at the bottom of the element, underneath it e.g.

<tr></tr>
<td></td>

I could quite easily be wrong though

afryer commented 10 years ago

In fact I think I am with .bottom() behaviour.