Implement :last-child and :first-child pseudo-classes, issue #1295

Patch for :last-child and :only-child pseudos. Reftests included, all passed.