Fixed a bug where NodeList#sort should convert the list to a NodeCollection before performing the sort function and updated the unit tests to reflect this.