Running the following comparison by using jQuery's "is" function will return false, since the DOM elements aren't exactly the same, although visually and functionally they are the same:
var $a = $('<div id="test" href="http://www.google.com"></div>');
var $b = $('<div href="http://www.google.com" id="test"></div>');
$a.is($b);//FALSE
Using direct comparison of the DOM objects will return false as well.
See Running example: http://jsfiddle.net/6zqwn/5/
So, is there a way to avoid taking the attributes' order into account when comparing?
(Why am I asking this question: I am using these comparisons in cross-browser unit tests in which different browsers change the attributes' order while still functionally creating the same DOM elements.)