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

@pathable/css-element-queries

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pathable/css-element-queries - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

.idea/css-element-queries.iml

2

package.json
{
"name": "@pathable/css-element-queries",
"version": "0.3.2",
"version": "0.3.3",
"description": "CSS-Element-Queries Polyfill. proof-of-concept for high-speed element dimension/media queries in valid css.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -384,5 +384,45 @@ /**

*/
this.init = function(withTracking) {
this.init = function (withTracking) {
trackingActive = typeof withTracking === 'undefined' ? false : withTracking;
var animationStart = 'animationstart';
if (typeof document.documentElement.style['webkitAnimationName'] !== 'undefined') {
animationStart = 'webkitAnimationStart';
} else if (typeof document.documentElement.style['MozAnimationName'] !== 'undefined') {
animationStart = 'mozanimationstart';
} else if (typeof document.documentElement.style['OAnimationName'] !== 'undefined') {
animationStart = 'oanimationstart';
}
document.body.addEventListener(animationStart, function (e) {
var element = e.target;
var styles = element && window.getComputedStyle(element, null);
var animationName = styles && styles.getPropertyValue('animation-name');
var requiresSetup = animationName && (-1 !== animationName.indexOf('element-queries'));
if (requiresSetup) {
element.elementQueriesSensor = new ResizeSensor(element, function () {
if (element.elementQueriesSetupInformation) {
element.elementQueriesSetupInformation.call();
}
});
var sensorStyles = window.getComputedStyle(element.resizeSensor, null);
var id = sensorStyles.getPropertyValue('min-width');
id = parseInt(id.replace('px', ''));
setupElement(e.target, idToSelectorMapping[id]);
}
});
if (!defaultCssInjected) {
cssStyleElement = document.createElement('style');
cssStyleElement.type = 'text/css';
cssStyleElement.innerHTML = '[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}';
//safari wants at least one rule in keyframes to start working
cssStyleElement.innerHTML += '\n@keyframes element-queries { 0% { visibility: inherit; } }';
document.getElementsByTagName('head')[0].appendChild(cssStyleElement);
defaultCssInjected = true;
}
for (var i = 0, j = document.styleSheets.length; i < j; i++) {

@@ -389,0 +429,0 @@ try {

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