Fix #13265 #13332: Allow .parent/.closest with text nodes. Close gh-1146.