Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

1.0.1: fixes for closure compiler #702

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
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "skrollr",
"version": "0.6.31",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this related to this PR? The version is left out of bower on purpose as it can use tags.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware that you could leave the version-nr out

"homepage": "http://prinzhorn.github.io/skrollr/",
"authors": [
"Alexander Prinzhorn"
Expand Down
35 changes: 17 additions & 18 deletions src/skrollr.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*!
/**
* skrollr core
*
* Alexander Prinzhorn - https://github.com/Prinzhorn/skrollr
*
* Free to use under terms of MIT license
*/
(function(window, document, undefined) {
(function(window, document) {
'use strict';

/*
/**
* Global api.
*/
var skrollr = {
Expand All @@ -25,7 +25,6 @@
//Minify optimization.
var hasProp = Object.prototype.hasOwnProperty;
var Math = window.Math;
var getStyle = window.getComputedStyle;

//They will be filled when skrollr gets initialized.
var documentElement;
Expand Down Expand Up @@ -102,11 +101,11 @@
var rxPrefixes = /^(?:O|Moz|webkit|ms)|(?:-(?:o|moz|webkit|ms)-)/;

//Detect prefix for current browser by finding the first property using a prefix.
if(!getStyle) {
if(!window.getComputedStyle) {
return;
}

var style = getStyle(body, null);
var style = window.getComputedStyle(body);

for(var k in style) {
//We check the key and if the key is a number, we check the value as well, because safari's getComputedStyle returns some weird array-like thingy.
Expand Down Expand Up @@ -223,6 +222,7 @@

/**
* Constructor.
* @constructor
*/
function Skrollr(options) {
documentElement = document.documentElement;
Expand Down Expand Up @@ -293,7 +293,7 @@
}

//Triggers parsing of elements and a first reflow.
_instance.refresh();
_instance.refresh(undefined);

_addEvent(window, 'resize orientationchange', function() {
var width = documentElement.clientWidth;
Expand Down Expand Up @@ -657,7 +657,7 @@
var skrollablesLength = _skrollables.length;

for(; skrollableIndex < skrollablesLength; skrollableIndex++) {
_reset(_skrollables[skrollableIndex].element);
_reset(_skrollables[skrollableIndex].element, false);
}

documentElement.style.overflow = body.style.overflow = '';
Expand All @@ -668,7 +668,7 @@
}

_instance = undefined;
_skrollrBody = undefined;
_skrollrBody = null;
_listeners = undefined;
_forceHeight = undefined;
_maxKeyFrame = 0;
Expand Down Expand Up @@ -759,9 +759,9 @@
lastTouchY = currentTouchY;
lastTouchTime = currentTouchTime;
break;
default:
case EVENT_TOUCHCANCEL:
case EVENT_TOUCHEND:
default:
var distanceY = initialTouchY - currentTouchY;
var distanceX = initialTouchX - currentTouchX;
var distance2 = distanceX * distanceX + distanceY * distanceY;
Expand Down Expand Up @@ -867,7 +867,7 @@
}

if(kf.mode === 'relative') {
_reset(element);
_reset(element, false);

kf.frame = _instance.relativeToAbsolute(anchorTarget, kf.anchors[0], kf.anchors[1]) - offset;

Expand Down Expand Up @@ -972,14 +972,14 @@

switch(skrollable.edgeStrategy) {
case 'reset':
_reset(element);
_reset(element, false);
continue;
case 'ease':
//Handle this case like it would be exactly at first/last keyframe and just pass it on.
frame = firstOrLastFrame.frame;
break;
default:
case 'set':
default:
var props = firstOrLastFrame.props;

for(key in props) {
Expand All @@ -994,8 +994,7 @@
}
}
}

continue;
break;
}
} else {
//Did we handle an edge last time?
Expand Down Expand Up @@ -1359,15 +1358,15 @@
if(undo) {
//Reset class and style to the "dirty" (set by skrollr) values.
element.style.cssText = skrollable.dirtyStyleAttr;
_updateClass(element, skrollable.dirtyClassAttr);
_updateClass(element, skrollable.dirtyClassAttr, undefined);
} else {
//Remember the "dirty" (set by skrollr) class and style.
skrollable.dirtyStyleAttr = element.style.cssText;
skrollable.dirtyClassAttr = _getClass(element);

//Reset class and style to what it originally was.
element.style.cssText = skrollable.styleAttr;
_updateClass(element, skrollable.classAttr);
_updateClass(element, skrollable.classAttr, undefined);
}
}
};
Expand All @@ -1379,7 +1378,7 @@
_translateZ = 'translateZ(0)';
skrollr.setStyle(_skrollrBody, 'transform', _translateZ);

var computedStyle = getStyle(_skrollrBody);
var computedStyle = window.getComputedStyle(_skrollrBody);
var computedTransform = computedStyle.getPropertyValue('transform');
var computedTransformWithPrefix = computedStyle.getPropertyValue(theDashedCSSPrefix + 'transform');
var has3D = (computedTransform && computedTransform !== 'none') || (computedTransformWithPrefix && computedTransformWithPrefix !== 'none');
Expand Down