This looks like a bug, but I’m not sure.
As far as I know, jQuerys .is() method will just check if the selector string matches the element you call it on (if you pass in a selector string ofc…)
If you full qualify the statement into
$('div:first').is('div:first')
it will correctly return true, but.. here comes the facepalm for me:
$('div:last').is(':last')
will again, correctly return true.
Check it out: http://jsfiddle.net/d6UGw/
It has to do with your markup.
div:lastmeans the lastdivin your markup.:lastmeans the lastelementin your markup.It’s probably returning true because your last element is a div.
div:firstmeans the first div in your markup.:firstalways returns the<html>element, as in a valid HTML doc, it’s your first element.So
$('div:first').is(':first')should never return true in a valid HTML doc.