Generate jQuery element from HTML, and find from it

Generate jQuery element from HTML, and find from it

I wrote the code as follows, but it didn't work well.
  1. var f = jQuery('<h1>foo</h1>').find('h1');
  2. console.log(f.size()); // expect 1, but actually 0
  3. console.log(f.text()); // expect "foo", but actually ""
What's wrong?