$(this) inside each()

$(this) inside each()

Hi all,
My code is something like this:
 selenium.browserbot.getCurrentWindow().$(selector).each(function()
 {
  var itm = $(this).closest("li").data("name");
  ...
  ...
  ...
 }
WHen i ran it, it complains that $(this) is a DOM element and therefore, does not have closest() method.
I am confused here. I thought that $(this) will be a jQuery object instead of DOM element?
Could anyone enlighten me?
Many thanks,
Sugi