Core: Throw an error on $("#") rather than returning 0-length collection

Closes gh-1682

Thanks @goob for the issue report!