Fix jQuery #13331: Detached node sorting

cc @timmywil @dmethvin

I'm not thrilled about +47 bytes to jquery.min.js.gz or about the performance hit, but at least the latter is mostly confined to applicable scenarios. At any rate, I couldn't come up with anything better here... if no one else can either, I guess we should just land this for jQuery 1.9.1.