{"action":"created","issue":{"url":"https://api.github.com/repos/prettydiff/prettydiff/issues/104","labels_url":"https://api.github.com/repos/prettydiff/prettydiff/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/prettydiff/prettydiff/issues/104/comments","events_url":"https://api.github.com/repos/prettydiff/prettydiff/issues/104/events","html_url":"https://github.com/prettydiff/prettydiff/issues/104","id":86726334,"number":104,"title":"XML comparison sometimes gives erroneous errors with attributes in different order","user":{"login":"murrayju","id":508461,"avatar_url":"https://avatars.githubusercontent.com/u/508461?v=3","gravatar_id":"","url":"https://api.github.com/users/murrayju","html_url":"https://github.com/murrayju","followers_url":"https://api.github.com/users/murrayju/followers","following_url":"https://api.github.com/users/murrayju/following{/other_user}","gists_url":"https://api.github.com/users/murrayju/gists{/gist_id}","starred_url":"https://api.github.com/users/murrayju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murrayju/subscriptions","organizations_url":"https://api.github.com/users/murrayju/orgs","repos_url":"https://api.github.com/users/murrayju/repos","events_url":"https://api.github.com/users/murrayju/events{/privacy}","received_events_url":"https://api.github.com/users/murrayju/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/prettydiff/prettydiff/labels/Defect","name":"Defect","color":"e11d21"},{"url":"https://api.github.com/repos/prettydiff/prettydiff/labels/Underway","name":"Underway","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-09T20:29:06Z","updated_at":"2015-06-12T19:52:09Z","closed_at":null,"body":"Prettydiff usually does a good job of ignoring differences just in the order of attributes. However, I've found some cases where it doesn't work. In the output, the attributes do not appear to be sorted on the offending lines.\r\n\r\nHere is an example gist containing two files to diff:\r\nhttps://gist.github.com/murrayju/5d99c370e06176044fa0\r\n(I'm confident that they are equal, oXygen's diff tool agrees)"},"comment":{"url":"https://api.github.com/repos/prettydiff/prettydiff/issues/comments/111598604","html_url":"https://github.com/prettydiff/prettydiff/issues/104#issuecomment-111598604","issue_url":"https://api.github.com/repos/prettydiff/prettydiff/issues/104","id":111598604,"user":{"login":"murrayju","id":508461,"avatar_url":"https://avatars.githubusercontent.com/u/508461?v=3","gravatar_id":"","url":"https://api.github.com/users/murrayju","html_url":"https://github.com/murrayju","followers_url":"https://api.github.com/users/murrayju/followers","following_url":"https://api.github.com/users/murrayju/following{/other_user}","gists_url":"https://api.github.com/users/murrayju/gists{/gist_id}","starred_url":"https://api.github.com/users/murrayju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murrayju/subscriptions","organizations_url":"https://api.github.com/users/murrayju/orgs","repos_url":"https://api.github.com/users/murrayju/repos","events_url":"https://api.github.com/users/murrayju/events{/privacy}","received_events_url":"https://api.github.com/users/murrayju/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T19:52:09Z","updated_at":"2015-06-12T19:52:09Z","body":"@prettydiff I looked into this a bit more, and I'm wondering about the implementation of the compareTo function for attributes.\r\n[markupmin.js line 157](https://github.com/prettydiff/prettydiff/blob/master/lib/markupmin.js#L157):\r\n```js\r\nsortfunc    = function markup_beauty__algorithm_loop_attributeOrder_sortfunc(aaa, bbb) {\r\n  if (aaa > bbb) {\r\n    return 1;\r\n  }\r\n  return 0;\r\n}\r\n```\r\n\r\nI don't understand why you don't have a case that returns `-1`, like this:\r\n```js\r\nsortfunc    = function markup_beauty__algorithm_loop_attributeOrder_sortfunc(aaa, bbb) {\r\n  if (aaa > bbb) {\r\n    return 1;\r\n  }\r\n  if (aaa < bbb) {\r\n    return -1;\r\n  }\r\n  return 0;\r\n}\r\n```\r\n\r\nMaking this change, I seem to get better results. I may be running into other issues now though, still trying to narrow those down."}}