.data() corrupts jquery chaining?

.data() corrupts jquery chaining?

Hi Folks,

the following code works fine, but the span is NOT a child of the Li element. Instead it is a child
of UL. If I remove the .data() from the chain, that SPAN is created as a child node, like it should be.

   
  1.  $(".mainmenu-filter-content ul")
    .append($("<li id='flt_" + data.id + "'></li>")
  2.                                 .data("filterdata", data))
  3.                                 .append($("<span class='small'>Foo!</span>"));

Do I miss anything here?