I’ve run into a problem where the DOM of Chrome and Firefox return different HTML results where they rearrange the attributes of elements when jQuery.html stringifys them. Don’t fight it outright with writing a bunch of code to check the existence of attribute values, etc.
Just write a “satisfies” assertion and get on with your day:
chai.expect(html).to.satisfy(
function(x) {
return (x === '<div a="1" b="2"></div>'
|| x === '<div b="2" a="1"></div>'
)
})
If the other browsers you’re testing in also give you grief, it is still probably easier (and faster) to just add to the satisfy’s clause than try to do a more sophisticated match.