提交 ef51c5b4 编写于 作者: J Julian Lloyd

ScrollReveal v4.0.1

上级 f969dd07
# Change Log
## Unreleased
## [4.0.1] - 2018-09-09
### Fixed
- Noop instances not correctly unmounting from the DOM. [#455]
- Readme links to pricing page no longer 404
- Noop instances were not correctly unmounting from the DOM. [#455]
- Readme links to pricing page no longer 404.
## [4.0.0] - 2018-08-06
......@@ -469,6 +469,7 @@ This version marks a significant change in how developers use ScrollReveal, intr
### Hello World
[4.0.0]: https://github.com/jlmakes/scrollreveal/compare/v4.0.0...v4.0.1
[4.0.0]: https://github.com/jlmakes/scrollreveal/compare/v3.3.6...v4.0.0
[3.3.6]: https://github.com/jlmakes/scrollreveal/compare/v3.3.5...v3.3.6
[3.3.5]: https://github.com/jlmakes/scrollreveal/compare/v3.3.4...v3.3.5
......
/*! @license ScrollReveal v4.0.0
/*! @license ScrollReveal v4.0.1
Copyright 2018 Fisssion LLC.
......@@ -46,16 +46,39 @@ var defaults = {
beforeReveal: function beforeReveal() {}
}
var noop = {
clean: function clean() {},
destroy: function destroy() {},
reveal: function reveal() {},
sync: function sync() {},
get noop() {
return true
function failure() {
var root = document.documentElement;
root.classList.remove('sr');
return {
clean: function clean() {},
destroy: function destroy() {},
reveal: function reveal() {},
sync: function sync() {},
get noop() {
return true
}
}
}
function success() {
var html = document.documentElement;
var body = document.body;
html.classList.add('sr');
if (body) {
body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', function () {
body.style.height = '100%';
});
}
}
var mount = { success: success, failure: failure }
function isObject(x) {
return (
x !== null &&
......@@ -1049,7 +1072,7 @@ function transitionSupported() {
return 'transition' in style || 'WebkitTransition' in style
}
var version = "4.0.0";
var version = "4.0.1";
var boundDelegate;
var boundDestroy;
......@@ -1073,21 +1096,17 @@ function ScrollReveal(options) {
if (!ScrollReveal.isSupported()) {
logger.call(this, 'Instantiation failed.', 'This browser is not supported.');
return noop
return mount.failure()
}
/**
* Here we use `buffer` to validate our configuration, before
* assigning the contents to the private variable `_config`.
*/
var buffer;
try {
buffer = config
? deepAssign({}, config, options)
: deepAssign({}, defaults, options);
} catch (e) {
logger.call(this, 'Instantiation failed.', 'Invalid configuration.', e.message);
return noop
logger.call(this, 'Invalid configuration.', e.message);
return mount.failure()
}
try {
......@@ -1095,28 +1114,25 @@ function ScrollReveal(options) {
if (!container) {
throw new Error('Invalid container.')
}
if ((!buffer.mobile && isMobile()) || (!buffer.desktop && !isMobile())) {
throw new Error('This device is disabled.')
}
} catch (e) {
logger.call(this, 'Instantiation failed.', e.message);
return noop
logger.call(this, e.message);
return mount.failure()
}
config = buffer;
/**
* Modify the DOM to reflect successful instantiation.
*/
document.documentElement.classList.add('sr');
if (document.body) {
document.body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', function () {
document.body.style.height = '100%';
});
if ((!config.mobile && isMobile()) || (!config.desktop && !isMobile())) {
logger.call(
this,
'This device is disabled.',
("desktop: " + (config.desktop)),
("mobile: " + (config.mobile))
);
return mount.failure()
}
mount.success();
this.store = {
containers: {},
elements: {},
......@@ -1145,10 +1161,6 @@ function ScrollReveal(options) {
return instance ? instance : (instance = this)
}
/**
* Static members are available immediately during instantiation,
* so debugging and browser support details are handled here.
*/
ScrollReveal.isSupported = function () { return transformSupported() && transitionSupported(); };
Object.defineProperty(ScrollReveal, 'debug', {
......
/*! @license ScrollReveal v4.0.0
/*! @license ScrollReveal v4.0.1
Copyright 2018 Fisssion LLC.
......@@ -48,16 +48,39 @@ var defaults = {
beforeReveal: function beforeReveal() {}
}
var noop = {
clean: function clean() {},
destroy: function destroy() {},
reveal: function reveal() {},
sync: function sync() {},
get noop() {
return true
function failure() {
var root = document.documentElement;
root.classList.remove('sr');
return {
clean: function clean() {},
destroy: function destroy() {},
reveal: function reveal() {},
sync: function sync() {},
get noop() {
return true
}
}
}
function success() {
var html = document.documentElement;
var body = document.body;
html.classList.add('sr');
if (body) {
body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', function () {
body.style.height = '100%';
});
}
}
var mount = { success: success, failure: failure }
/*! @license is-dom-node v1.0.4
Copyright 2018 Fisssion LLC.
......@@ -1424,7 +1447,7 @@ function transitionSupported() {
return 'transition' in style || 'WebkitTransition' in style
}
var version = "4.0.0";
var version = "4.0.1";
var boundDelegate;
var boundDestroy;
......@@ -1448,21 +1471,17 @@ function ScrollReveal(options) {
if (!ScrollReveal.isSupported()) {
logger.call(this, 'Instantiation failed.', 'This browser is not supported.');
return noop
return mount.failure()
}
/**
* Here we use `buffer` to validate our configuration, before
* assigning the contents to the private variable `_config`.
*/
var buffer;
try {
buffer = config
? deepAssign({}, config, options)
: deepAssign({}, defaults, options);
} catch (e) {
logger.call(this, 'Instantiation failed.', 'Invalid configuration.', e.message);
return noop
logger.call(this, 'Invalid configuration.', e.message);
return mount.failure()
}
try {
......@@ -1470,28 +1489,25 @@ function ScrollReveal(options) {
if (!container) {
throw new Error('Invalid container.')
}
if ((!buffer.mobile && isMobile()) || (!buffer.desktop && !isMobile())) {
throw new Error('This device is disabled.')
}
} catch (e) {
logger.call(this, 'Instantiation failed.', e.message);
return noop
logger.call(this, e.message);
return mount.failure()
}
config = buffer;
/**
* Modify the DOM to reflect successful instantiation.
*/
document.documentElement.classList.add('sr');
if (document.body) {
document.body.style.height = '100%';
} else {
document.addEventListener('DOMContentLoaded', function () {
document.body.style.height = '100%';
});
if ((!config.mobile && isMobile()) || (!config.desktop && !isMobile())) {
logger.call(
this,
'This device is disabled.',
("desktop: " + (config.desktop)),
("mobile: " + (config.mobile))
);
return mount.failure()
}
mount.success();
this.store = {
containers: {},
elements: {},
......@@ -1520,10 +1536,6 @@ function ScrollReveal(options) {
return instance ? instance : (instance = this)
}
/**
* Static members are available immediately during instantiation,
* so debugging and browser support details are handled here.
*/
ScrollReveal.isSupported = function () { return transformSupported() && transitionSupported(); };
Object.defineProperty(ScrollReveal, 'debug', {
......
此差异已折叠。
{
"name": "scrollreveal",
"version": "4.0.0",
"version": "4.0.1",
"description": "Animate elements as they scroll into view",
"homepage": "https://scrollrevealjs.org",
"main": "dist/scrollreveal.js",
......@@ -23,7 +23,14 @@
"sandbox:server": "node ./.ignore/sandbox/server.sandbox.js",
"coverage:server": "node ./.ignore/coverage/server.coverage.js"
},
"keywords": ["scroll", "animation", "reveal", "css", "transform", "transition"],
"keywords": [
"scroll",
"animation",
"reveal",
"css",
"transform",
"transition"
],
"repository": {
"type": "git",
"url": "https://github.com/scrollreveal/scrollreveal.git"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册