Fix superselector detection for non-descendant selectors.

Closes #1479
Fix selector pseudoclass extension.

Closes #1476
Closes #1481