Question about is() function

Question about is() function

  1. HTML
  2. <ul>
  3. <li>i have <strong>one</strong> here and <strong>another</strong></li>
  4. <li>i have only <strong>one</strong></li>
  5. </ul>

  1. $('li').click(
  2. function()
  3. {
  4. var isTwo=$(this).is(
  5. function()
  6. {
  7. return $('strong',$(this)).length==2;
  8. }
  9. );
  10. if (isTwo)
  11. {
  12. $(this).css('background','green');
  13. }
  14. else
  15. {
  16. $(this).css('background','yellow');
  17. }
  18. }
  19. );

My question is what does $(this) in $(this).is(.............) do here? If I change to $('strong').is(..........) it doesn't work as expected.