Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-window

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-window - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

.travis.yml

4

component.json
{
"name": "get-window",
"repo": "webmodules/get-window",
"version": "0.0.2",
"version": "1.0.0",
"description": "Returns the `window` object from a DOM object",

@@ -19,4 +19,4 @@ "keywords": [

"dependencies": {
"webmodules/get-document": "0.1.0"
"webmodules/get-document": "1.0.0"
}
}
1.0.0 / 2015-01-25
==================
* add `README.md` file
* add `.travis.yml`` file
* index: add old IE fallback
* index: update JSDocs
* update "get-document" to v1.0.0
* package: run "make test" for `npm test`
* package: add "zuul" as a dev dep
* test: add mocha tests
* test: use uppercase IFRAME syntax
* test: skip Range and Selection tests on IE <= 8
* test: fix old IE <= 8 IFRAME test
0.0.2 / 2014-06-27
==================
* component, package: update repository owner name
* component, package: update repository owner name

@@ -10,3 +25,3 @@ 0.0.1 / 2014-06-27

* gitignore: add .gitignore file
* initial commit
* gitignore: add .gitignore file
* initial commit

@@ -14,6 +14,9 @@

// old-IE fallback logic: http://stackoverflow.com/a/10260692
var needsIEFallback = !!document.attachEvent && window !== document.parentWindow;
/**
* Returns `true` if `w` is a Window object, or `false` otherwise.
*
* @param {?} w - Window object, maybe
* @param {Mixed} w - Window object, maybe
* @return {Boolean}

@@ -28,5 +31,8 @@ * @private

/**
* Returns the `window` object associated with the given `node`, which may be
* a DOM element, the Window object, a Selection, a Range. Basically any DOM
* object that references the Window in some way, this function will find it.
*
* @param {Mixed} node - DOM node, selection, or range in which to find the `document` object
* @return {Document} the `window` object associated with `node`
* @param {Mixed} node - DOM node, selection, or range in which to find the `window` object
* @return {Window} the `window` object associated with `node`
* @public

@@ -40,5 +46,18 @@ */

// TODO: add old-IE fallback logic: http://stackoverflow.com/a/10260692
var doc = getDocument(node);
return doc.defaultView;
if (needsIEFallback) {
// In IE 6-8, only the variable 'window' can be used to connect events (others
// may be only copies).
doc.parentWindow.execScript('document._parentWindow = window;', 'Javascript');
var win = doc._parentWindow;
// to prevent memory leak, unset it after use
// another possibility is to add an onUnload handler,
// (which seems overkill to @liucougar)
doc._parentWindow = null;
return win;
} else {
// standards-compliant and newer IE
return doc.defaultView || doc.parentWindow;
}
}
{
"name": "get-window",
"version": "0.0.2",
"version": "1.0.0",
"description": "Returns the `window` object from a DOM object",
"scripts": {
"test": "make test"
},
"keywords": [

@@ -15,3 +18,3 @@ "dom",

"dependencies": {
"get-document": "0.1.0"
"get-document": "1"
},

@@ -26,3 +29,6 @@ "component": {

"url": "https://github.com/webmodules/get-window.git"
},
"devDependencies": {
"zuul": "~1.16.5"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc