Skip to content

Commit eb89785

Browse files
author
Ola Holmström
committed
add umd and bump version
1 parent a47f5b1 commit eb89785

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

bower.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"main": [
44
"scrollparent.js"
55
],
6-
"version": "1.0.0",
6+
"dependencies": {},
7+
"version": "1.0.1",
78
"homepage": "https://github.com/olahol/scrollparent.js",
89
"description": "A function to get the scrolling parent of an html element.",
910
"keywords": [
@@ -20,6 +21,5 @@
2021
"node_modules",
2122
"bower_components",
2223
"test.html"
23-
],
24-
"dependencies": {}
24+
]
2525
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scrollparent",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A function to get the scrolling parent of an html element.",
55
"main": "scrollparent.js",
66
"repository": {

scrollparent.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
;(function () {
1+
(function (root, factory) {
2+
if (typeof define === "function" && define.amd) {
3+
define([], factory);
4+
} else if (typeof module === "object" && module.exports) {
5+
module.exports = factory();
6+
} else {
7+
root.Scrollparent = factory();
8+
}
9+
}(this, function () {
10+
var regex = /(auto|scroll)/;
11+
212
var parents = function (node, ps) {
313
if (node.parentNode === null) { return ps; }
414

@@ -14,7 +24,7 @@
1424
};
1525

1626
var scroll = function (node) {
17-
return (/(auto|scroll)/).test(overflow(node));
27+
return regex.test(overflow(node));
1828
};
1929

2030
var scrollParent = function (node) {
@@ -33,10 +43,5 @@
3343
return document.body;
3444
};
3545

36-
// If common js is defined use it.
37-
if (typeof module === "object" && module !== null) {
38-
module.exports = scrollParent;
39-
} else {
40-
window.Scrollparent = scrollParent;
41-
}
42-
})();
46+
return scrollParent;
47+
}));

0 commit comments

Comments
 (0)