-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(jqLite): do not break if Node
is not available
#13492
fix(jqLite): do not break if Node
is not available
#13492
Conversation
Does anyone have any idea how/if we can test that it works if |
Did we identify for which browser this breaks? If so then we should be able to reproduce the problem in a unit test easily enough by including that browser in our testing... |
If I understood the usecase in #13442 correctly, this isn't fixing a browser issue, but some specific setup issue (with requirejs, maybe server-side stuff), where The original fix that was solved by 941c1c3 (which introduced the dependecy on We are already testing against IE9-11, so we would be good to go in that respect. |
I would rather not do the check on every call to var jqLiteContains = $window.Node && $window.Node.prototype.contains || function(arg) {
... |
I thought about that too, but I wanted to use the "native" Besides, in the majority of cases (where But, yeah, I could have gone with your version, I just had to pick one. |
I don't understand when |
I'm not sure either (maybe @jlmitch5 or @neha-nsharma can shed more light on this). Maybe using a JS DOM implementation for testing (e.g. jsdom). |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I signed it (?) |
I am loathe to land this without a more concrete example of where this is failing. |
@petebacondarwin, it was also reported in #13391. It seems indeed to be failing with |
CLAs look good, thanks! |
It looks to me that you can define a window object via jsdom and add it to the global context (https://github.com/tmpvar/jsdom#for-the-hardcore-jsdomjsdom and https://github.com/tmpvar/jsdom#creating-a-browser-like-window-object). and that Node ought to be available on that window (https://github.com/tmpvar/jsdom/blob/2184995dc6531cb92d219497c8f88c9b7f088bc1/lib/jsdom/living/node.js). If not then I would raise a bug in jsdom. Can anyone provide an actual running example of this problem? |
@petebacondarwin, according to #13442 (comment) (and subsequent discussion), it seems that changing It sounds a reasonable change to me. WDYT ? |
I need to see an actual real running example where this is breaking. |
Closing in favour of a deeper investigation from @mgol of the other possible ways that using |
Fixes #13442