Probably a combination of pure luck and bad ass debugging skills (not!)...
Actually I changed line 3643 of env.js to the following to print the element id's of the elements being compared since the error was in compareDocumentPosition:
- console.log("comparing document position %s %s", this.id, b.id);
That resulting in the following output at the time of the error:
- comparing document position cboxLoadingGraphic cboxLoadingOverlay
I seached my app for those, but also recognized that the cbox was for colorbox. I started by removing the plugin from being steal'ed and the build did not throw the error.
Then I looked at the colorbox plugincode to see what was being executed and I see that on document.ready it executes the function appendHTML. Looking in that function I saw that line 405 was:
- $loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic"));
Commenting out that line also make the build not throw the error.
That's pretty much exactly how I got to this conclusion. Then I looked at the add function in jQuery 1.8.3 and 1.9.1 and saw the differences.