thatcher / env-js

A pure-JavaScript browser environment.
http://www.envjs.com/
463 stars 75 forks source link

compareDocumentPosition Error #52

Open thecountofzero opened 11 years ago

thecountofzero commented 11 years ago

I am getting the following error when using/loading the jQuery colorbox plugin.

https://github.com/jackmoore/colorbox/blob/master/jquery.colorbox.js

comparing document position cboxLoadingGraphic cboxLoadingOverlay !!!!!!!!!!! ERROR !!!!!!!!!!!

-message = Cannot read property "childNodes" from null -fileName = steal/rhino/env.js -lineNumber = 3480 -name = TypeError

I have identified the line in the plugin to the following line:

https://github.com/jackmoore/colorbox/blob/master/jquery.colorbox.js#L409

Everything works fine in jQuery1.8.3, but breaks when I move to 1.9.1

I noticed that the add function in jQuery has changed in 1.9.1

If I change the following line in env.js in compareDocumentPosition:

if(a.parentNode === b.parentNode){

to

if(a.parentNode && a.parentNode === b.parentNode) {

then things work.

Thoughts?