-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add is-node & fix is-browser-window not to check for SimpleDOM #35
Conversation
This adds [is-node from can-util](https://github.com/canjs/can-util/tree/7e8669a666072dcbdcc34402b640a67d38ea5784/js/is-node) and changes is-browser-window to use `is-node` instead of checking for SimpleDOM’s presence. This change was made because in 4.0, [this check](https://github.com/canjs/can-util/blob/7e8669a666072dcbdcc34402b640a67d38ea5784/dom/events/events.js#L81) was returning false when run in the main production build of CanJS (where can-simple-dom is also packaged).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return typeof window !== "undefined" && | ||
typeof document !== "undefined" && typeof SimpleDOM === "undefined"; | ||
typeof document !== "undefined" && | ||
isNode === false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the isNode
I'm not 100% sure on long-term. I think NWJS should be considered a browser window. I'm not sure how we can sniff this out, but isNode ==== false
is fine for now. We'll need something later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done-autorender has a change for when running in nwjs. I agree though, using clientWidth or something would be a better solution long-term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue to fix this long-term: #36
I realized that |
This adds is-node from can-util and changes is-browser-window to use
is-node
instead of checking for SimpleDOM’s presence.This change was made because in 4.0, this check was returning false when run in the main production build of CanJS (where can-simple-dom is also packaged).