Skip to content

Instantly share code, notes, and snippets.

@ahirschberg
Last active August 29, 2015 14:17
some code in librifox that I refactored
// Initial code:
var xml = xhr.response;
var xmlDoc = $.parseXML( xml ); // xml variable is never referenced after this line
var newXML = $( xmlDoc ); // redundant form of above line, does nothing
var title = newXML.find( "title" ); // misleading, should be plural 'titles' (#find returns all title tags in the document)
var enclosure = newXML.find("enclosure"); // never used
var currTitle; // unnecessary
var currEnclosure; // unnecessary, never used
// Refactored into:
var xml = $(xhr.response); // consoliated lines 2 - 4 from above
var titles = xml.find("title"); // plural variable name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment