Skip to content
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

Upgrade to 1.1.4 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* Stickyfill -- `position: sticky` polyfill
* v. 1.1.1 | https://github.com/wilddeer/stickyfill
* v. 1.1.4 | https://github.com/wilddeer/stickyfill
* Copyright Oleg Korsunsky | http://wd.dizaina.net/
*
* MIT License
Expand All @@ -14,7 +14,7 @@ module.exports = (function(doc, win) {
if (!win) {
win = window;
}

var watchArray = [],
scroll,
initialized = false,
Expand Down Expand Up @@ -59,7 +59,7 @@ module.exports = (function(doc, win) {
}

function mergeObjects(targetObj, sourceObject) {
for (key in sourceObject) {
for (var key in sourceObject) {
if (sourceObject.hasOwnProperty(key)) {
targetObj[key] = sourceObject[key];
}
Expand All @@ -83,7 +83,7 @@ module.exports = (function(doc, win) {
rebuild();
return;
}

if (win.pageYOffset != scroll.top) {
updateScrollPos();
recalcAllPos();
Expand Down Expand Up @@ -130,7 +130,7 @@ module.exports = (function(doc, win) {
}

function initElement(el) {
if (isNaN(parseFloat(el.computed.top)) || el.isCell) return;
if (isNaN(parseFloat(el.computed.top)) || el.isCell || el.computed.display == 'none') return;

el.inited = true;

Expand Down Expand Up @@ -256,7 +256,8 @@ module.exports = (function(doc, win) {
marginBottom: computedStyle.marginBottom,
marginLeft: computedStyle.marginLeft,
marginRight: computedStyle.marginRight,
cssFloat: computedStyle.cssFloat
cssFloat: computedStyle.cssFloat,
display: computedStyle.display
},
numeric = {
top: parseNumeric(computedStyle.top),
Expand All @@ -282,7 +283,7 @@ module.exports = (function(doc, win) {
},
nodeOffset = getElementOffset(node),
parentOffset = getElementOffset(parentNode),

parent = {
node: parentNode,
css: {
Expand Down Expand Up @@ -398,11 +399,11 @@ module.exports = (function(doc, win) {
if (!initialized) return;

deinitAll();

for (var i = watchArray.length - 1; i >= 0; i--) {
watchArray[i] = getElementParams(watchArray[i].node);
}

initAll();
}

Expand All @@ -420,7 +421,7 @@ module.exports = (function(doc, win) {

function stop() {
pause();
deinitAll();
deinitAll();
}

function kill() {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stickyfill",
"description": "A polyfill for `position: sticky` for browsers that don't support it yet.",
"version": "1.1.1",
"version": "1.1.4",
"tags": [
"polyfill",
"webmodule",
Expand Down