Bug Tracker

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#13566 closed bug (fixed)

v2.0.0b2 is not compatible for earlier versions on Node

Reported by: brilliantpenguin@… Owned by: Rick Waldron
Priority: low Milestone: None
Component: core Version: 2.0b2
Keywords: Cc:
Blocked by: Blocking:

Description

Please see L:8668 and L:8690 in the 2.0.0b2.

Unfortunately some compatibility is lost although I think it's awesome implement supporting Node module pattern.

I'm using jQuery on Node with jsdom. This architecture works well 1.9.1, 2.0.0b1 but doesn't work 2.0.0bx.

I have 2 requirements written below:

(1) L:8690

Please use "window" substitute for "this".

(2) L:8668

add condition " && typeof process == 'undefined'" so that Node process is not return true in this "if" condition

How is it?

Change History (9)

comment:1 Changed 7 years ago by Rick Waldron

I'm going to ping Isaac S on this

comment:2 Changed 7 years ago by isaacs

I think the solution here is to skip the Node-style stuff if typeof window === 'object', so that Browser-emulators can get the Browser-style result, even in Node.

comment:3 Changed 7 years ago by ystk_skm (brilliantpenguin@…

isaacs

thank you for your suggestion.

Please give attention to that I know some Browser-emulators in Node returns typeof window === 'object' true. And the matter of here that the compatibility problem is not resolved.

comment:4 Changed 7 years ago by isaacs

Yeah, on further consideration, I think that this is just something that jQuery should not fix. The major version number is getting incremented to 2.0, so it's a good time to make some breaking changes.

Browser emulators in Node can run the "client" code in such a way that module and module.exports are not exposed, using the built-in vm module. This is an easy workaround, and probably the correct approach anyway.

comment:5 Changed 7 years ago by ystk_skm <brilliantpenguin@…>

isaacs

I understand your guidance for Browser emulation on Node.
I know that it's time to make some breaking changes for jQuery, but, I cannot understand why these 2 fundamental specification changing which may cause unexpected error is necessary.
Could you explain why you think that this is just something that jQuery should not fix.

comment:6 Changed 7 years ago by timmywil

Component: unfiledcore
Priority: undecidedlow
Status: newopen
Version: git2.0b2

comment:7 Changed 6 years ago by Rick Waldron

Owner: set to Rick Waldron
Status: openassigned

comment:8 Changed 6 years ago by Rick Waldron

Resolution: fixed
Status: assignedclosed

Fixes #13566. If there is a window object, define jQuery and $

Signed-off-by: Rick Waldron <waldron.rick@…>

Changeset: 37c801eda5a96ba8d58f3d8751c42df296d3bd39

comment:9 Changed 6 years ago by Rick Waldron

Fixes #13566. If there is a window object, and it has a document property, it might be the window we want, so define jQuery and $. Thanks to @dcherman for saving us from that embarrassment!

Signed-off-by: Rick Waldron <waldron.rick@…>

Changeset: 6358da8aa32e7ed52da3af1a912bdd1a05863faf

Note: See TracTickets for help on using tickets.