Comparing version 0.0.2 to 1.0.0
{ | ||
"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 |
29
index.js
@@ -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" | ||
} | ||
} |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8053
9
142
1
0
16
1
+ Addedget-document@1.0.0(transitive)
- Removedget-document@0.1.0(transitive)
Updatedget-document@1