New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

audero-sticky

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

audero-sticky - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

2

bower.json
{
"name": "audero-sticky",
"version": "0.3.1",
"version": "0.3.2",
"description": "Audero Sticky is a polyfill for the CSS position: sticky with no dependencies and support for multiple module systems.",

@@ -5,0 +5,0 @@ "main": "src/audero-sticky.js",

@@ -1,3 +0,3 @@

/*! audero-sticky.js 0.3.1 | Aurelio De Rosa (@AurelioDeRosa) | MIT/GPL-3.0 Licensed */
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.Sticky=b()}(this,function(){"use strict";function a(a,b){return a[x]&&b?a[x][b]:a[x]}function b(a,b,c){if(a[x]||(a[x]={}),"string"==typeof b)return void(a[x][b]=c);for(var d in b)b.hasOwnProperty(d)&&(a[x][d]=b[d])}function c(a){delete a[x]}function d(a,b,c){var d=document.createEvent("Event");d.initEvent(b,!0,!0);for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);a.dispatchEvent(d)}function e(a){var b={};a=a||{};for(var c in v)v.hasOwnProperty(c)&&(b[c]=a[c]||v[c]);return b}function f(a,b){var c=new RegExp("\\b"+b+"\\b");c.test(a.className)||(a.className+=" "+b)}function g(a,b){var c=new RegExp("\\b"+b+"\\b");a.className=a.className.replace(c,"").trim()}function h(a){var b,c;return f(a.element,a.settings.activeClass),b=window.getComputedStyle(a.element),c={marginBottom:b.marginBottom,marginTop:b.marginTop},g(a.element,a.settings.activeClass),c}function i(a,b){b.forEach(function(b){a[b]=""})}function j(a,b,c){c||(c=Object.keys(b)),c.forEach(function(c){a[c]=b[c]})}function k(a){var b=a.style.position;a.style.position="relative";var c=Number(window.getComputedStyle(a).zIndex);return a.style.position=b,isNaN(c)?void 0:c}function l(a,b){var c=k(a);if(void 0!==c)return c;var d=[].slice.call(document.querySelectorAll(b));return d.indexOf(a)+1}function m(a){var b={};for(var c in a)b[c]=a[c]+"px";return b}function n(b){var c=a(b.element);i(b.element.style,w.concat(["marginTop","marginBottom"])),b.element.style.position=c.position,c.placeholder&&c.placeholder.parentNode&&c.placeholder.parentNode.removeChild(c.placeholder)}function o(a,b){var c={},d=window.getComputedStyle(a),e=a.parentNode.getBoundingClientRect();return"auto"!==d.top?(c.start=a.getBoundingClientRect().top-parseFloat(d.top),c.end=e.bottom-(parseFloat(b.marginBottom)||0)):(c.start=a.getBoundingClientRect().bottom+parseFloat(d.bottom),c.end=e.top+(parseFloat(b.marginTop)||0)),c.start+=window.pageYOffset,c.end+=window.pageYOffset,c}function p(b){var c=b.element.getBoundingClientRect(),d=a(b.element,"placeholder");j(d.style,window.getComputedStyle(b.element),["top","bottom","marginTop","marginBottom","marginLeft","marginRight"]),j(d.style,m(c),["width","height","left"])}function q(c){function e(){p(c),b(c.element,"position",c.element.style.position),j(c.element.style,{position:"fixed"}),j(c.element.style,s.placeholder.style,w),c.element.parentNode.insertBefore(s.placeholder,c.element),d(c.element,"stickystart"),f(c.element,c.settings.activeClass)}function i(){n(c),d(c.element,"stickyend"),g(c.element,c.settings.activeClass)}function k(){var a=s.placeholder.parentNode;q=a?o(s.placeholder,m):o(c.element,m);var b=parseFloat(window.getComputedStyle(c.element).height)||0,d=q.end-b-window.pageYOffset,f=window.pageYOffset>=q.start&&window.pageYOffset<=q.end;f?(a||e(),c.element.style.top=d-t>=0?"":d+"px"):a&&i()}function l(){var a=s.placeholder.parentNode;q=a?o(s.placeholder,m):o(c.element,m);var b=parseFloat(window.getComputedStyle(c.element).height)||0,d=window.pageYOffset+window.innerHeight,f=q.end+b-d,g=d<=q.start&&d>=q.end;g?(a||e(),c.element.style.bottom=0>=f+t?"":-f+"px"):a&&i()}var m=h(c),q=o(c.element,m),r=window.getComputedStyle(c.element),s=a(c.element),t="auto"!==r.top?parseFloat(r.top):parseFloat(r.bottom);return"auto"!==r.top?k:l}function r(b){return function(){b.destroy(),b.init(),a(b.element,"handlers").scroll()}}function s(b){var c=a(b.element,"handlers");window.addEventListener("load",c.scroll),window.addEventListener("scroll",c.scroll),window.addEventListener("resize",c.resize)}function t(b){var c=a(b.element,"handlers");window.removeEventListener("load",c.scroll),window.removeEventListener("scroll",c.scroll),window.removeEventListener("resize",c.resize)}function u(a,b){this.element=a,this.settings=e(b)}var v={selector:".sticky",activeClass:"sticky--active"},w=["width","height","left","marginLeft","marginRight","zIndex"],x="auderoSticky";return u.isFeatureSupported=function(){var a=["ms","webkit"],b="position:sticky;",c=document.createElement("div");return a.forEach(function(a){b+="position:-"+a+"-sticky;"}),c.style.cssText=b,!!c.style.position},u.autoInit=function(a){var b=a&&a.selector?a.selector:v.selector;[].forEach.call(document.querySelectorAll(b),function(b){var c=new u(b,a);c.init()})},u.prototype.init=function(){if(a(this.element))throw new Error("This element has already been initialized");var c=document.createElement(this.element.nodeName);b(this.element,"placeholder",c),b(this.element,"handlers",{scroll:q(this),resize:r(this)}),j(c.style,{visibility:"hidden",zIndex:l(this.element,this.settings.selector)}),p(this),s(this),a(this.element,"handlers").scroll()},u.prototype.destroy=function(){n(this),t(this),c(this.element)},u});
/*! audero-sticky.js 0.3.2 | Aurelio De Rosa (@AurelioDeRosa) | MIT/GPL-3.0 Licensed */
!function(a,b){"use strict";"function"==typeof define&&define.amd?define(b):"object"==typeof module&&module.exports?module.exports=b():a.Sticky=b()}(this,function(){"use strict";function a(a,b){return a[z]&&b?a[z][b]:a[z]}function b(){var a=!1;try{var b=Object.defineProperty({},"passive",{get:function(){a=!0}});window.addEventListener("",null,b)}catch(a){}return a}function c(a,b,c){if(a[z]||(a[z]={}),"string"==typeof b)return void(a[z][b]=c);for(var d in b)b.hasOwnProperty(d)&&(a[z][d]=b[d])}function d(a){delete a[z]}function e(a,b,c){var d=document.createEvent("Event");d.initEvent(b,!0,!0);for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e]);a.dispatchEvent(d)}function f(a){var b={};a=a||{};for(var c in w)w.hasOwnProperty(c)&&(b[c]=a[c]||w[c]);return b}function g(a,b){var c=new RegExp("\\b"+b+"\\b");c.test(a.className)||(a.className+=" "+b)}function h(a,b){var c=new RegExp("\\b"+b+"\\b");a.className=a.className.replace(c,"").trim()}function i(a){var b,c;return g(a.element,a.settings.activeClass),b=window.getComputedStyle(a.element),c={marginBottom:b.marginBottom,marginTop:b.marginTop},h(a.element,a.settings.activeClass),c}function j(a,b){b.forEach(function(b){a[b]=""})}function k(a,b,c){c||(c=Object.keys(b)),c.forEach(function(c){a[c]=b[c]})}function l(a){var b=a.style.position;a.style.position="relative";var c=Number(window.getComputedStyle(a).zIndex);return a.style.position=b,isNaN(c)?void 0:c}function m(a,b){var c=l(a);if(void 0!==c)return c;var d=[].slice.call(document.querySelectorAll(b));return d.indexOf(a)+1}function n(a){var b={};for(var c in a)b[c]=a[c]+"px";return b}function o(b){var c=a(b.element);j(b.element.style,y.concat(["marginTop","marginBottom","top","bottom"])),b.element.style.position=c.position,c.placeholder&&c.placeholder.parentNode&&c.placeholder.parentNode.removeChild(c.placeholder)}function p(a,b){var c={},d=window.getComputedStyle(a),e=a.parentNode.getBoundingClientRect();return"auto"!==d.top?(c.start=a.getBoundingClientRect().top-parseFloat(d.top),c.end=e.bottom-(parseFloat(b.marginBottom)||0)):(c.start=a.getBoundingClientRect().bottom+parseFloat(d.bottom),c.end=e.top+(parseFloat(b.marginTop)||0)),c.start+=window.pageYOffset,c.end+=window.pageYOffset,c}function q(b){var c=b.element.getBoundingClientRect(),d=a(b.element,"placeholder");k(d.style,window.getComputedStyle(b.element),["top","bottom","marginTop","marginBottom","marginLeft","marginRight"]),k(d.style,n(c),["width","height","left"])}function r(b){function d(){q(b),c(b.element,"position",b.element.style.position),k(b.element.style,{position:"fixed"}),k(b.element.style,s.placeholder.style,y),b.element.parentNode.insertBefore(s.placeholder,b.element),e(b.element,"stickystart"),g(b.element,b.settings.activeClass)}function f(){o(b),e(b.element,"stickyend"),h(b.element,b.settings.activeClass)}function j(){var a=s.placeholder.parentNode;n=a?p(s.placeholder,m):p(b.element,m);var c=parseFloat(window.getComputedStyle(b.element).height)||0,e=n.end-c-window.pageYOffset,g=window.pageYOffset>=n.start&&window.pageYOffset<=n.end;g?(a||d(),b.element.style.top=e-t>=0?"":e+"px"):a&&f()}function l(){var a=s.placeholder.parentNode;n=a?p(s.placeholder,m):p(b.element,m);var c=parseFloat(window.getComputedStyle(b.element).height)||0,e=window.pageYOffset+window.innerHeight,g=n.end+c-e,h=e<=n.start&&e>=n.end;h?(a||d(),b.element.style.bottom=0>=g+t?"":-g+"px"):a&&f()}var m=i(b),n=p(b.element,m),r=window.getComputedStyle(b.element),s=a(b.element),t="auto"!==r.top?parseFloat(r.top):parseFloat(r.bottom);return"auto"!==r.top?j:l}function s(b){return function(){b.destroy(),b.init(),a(b.element,"handlers").scroll()}}function t(c){var d=a(c.element,"handlers");window.addEventListener("load",d.scroll),window.addEventListener("scroll",d.scroll,b()?x:!1),window.addEventListener("resize",d.resize)}function u(c){var d=a(c.element,"handlers");window.removeEventListener("load",d.scroll),window.removeEventListener("scroll",d.scroll,b()?x:!1),window.removeEventListener("resize",d.resize)}function v(a,b){this.element=a,this.settings=f(b)}var w={selector:".sticky",activeClass:"sticky--active"},x={passive:!0},y=["width","height","left","marginLeft","marginRight","zIndex"],z="auderoSticky";return v.isFeatureSupported=function(){var a=["ms","webkit"],b="position:sticky;",c=document.createElement("div");return a.forEach(function(a){b+="position:-"+a+"-sticky;"}),c.style.cssText=b,!!c.style.position},v.autoInit=function(a){var b=a&&a.selector?a.selector:w.selector;[].forEach.call(document.querySelectorAll(b),function(b){var c=new v(b,a);c.init()})},v.prototype.init=function(){if(a(this.element))throw new Error("This element has already been initialized");var b=document.createElement(this.element.nodeName);c(this.element,"placeholder",b),c(this.element,"handlers",{scroll:r(this),resize:s(this)}),k(b.style,{visibility:"hidden",zIndex:m(this.element,this.settings.selector)}),q(this),t(this),a(this.element,"handlers").scroll()},v.prototype.destroy=function(){o(this),u(this),d(this.element)},v});
//# sourceMappingURL=audero-sticky.min.js.map
{
"name": "audero-sticky",
"version": "0.3.1",
"version": "0.3.2",
"description": "Audero Sticky is a polyfill for the CSS position: sticky with no dependencies and support for multiple module systems.",

@@ -5,0 +5,0 @@ "main": "src/audero-sticky.js",

@@ -34,2 +34,11 @@ (function(root, factory) {

/**
* The settings to use when adding the event handler for the scroll event
*
* @type {Object}
*/
var scrollOptions = {
passive: true
};
/**
* The properties needed by the placeholder element to have the

@@ -72,2 +81,23 @@ * occupy the same space as the element when in its original position

/**
* Tests if passive event listeners are supported
*
* @return {boolean}
*/
function isPassiveEventListenerSupported() {
var isSupported = false;
try {
var options = Object.defineProperty({}, 'passive', {
get: function() {
isSupported = true;
}
});
window.addEventListener('', null, options);
} catch(ex) {}
return isSupported;
}
/**
* Sets the value of the required property for a given element.

@@ -311,3 +341,5 @@ * If <code>property</code> is an object, all its key-value pairs are set.

'marginTop',
'marginBottom'
'marginBottom',
'top',
'bottom'
])

@@ -504,3 +536,3 @@ );

window.addEventListener('load', handlers.scroll);
window.addEventListener('scroll', handlers.scroll);
window.addEventListener('scroll', handlers.scroll, isPassiveEventListenerSupported() ? scrollOptions : false);
window.addEventListener('resize', handlers.resize);

@@ -518,3 +550,3 @@ }

window.removeEventListener('load', handlers.scroll);
window.removeEventListener('scroll', handlers.scroll);
window.removeEventListener('scroll', handlers.scroll, isPassiveEventListenerSupported() ? scrollOptions : false);
window.removeEventListener('resize', handlers.resize);

@@ -521,0 +553,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc