Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copy-styles

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy-styles - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

17

dist/bundle.js

@@ -50,2 +50,6 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

// http://www.w3.org/TR/SVG/propidx.html
// via https://github.com/svg/svgo/blob/master/plugins/_collections.js
var inheritableAttrs = ['clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'transform', 'visibility', 'white-space', 'word-spacing', 'writing-mode'];
// Copies computed styles from source to target

@@ -79,5 +83,14 @@ /**

for (var key in defaultStyles) {
var def = defaultStyles[key];
if (def === false) continue; // copy never
var src = srcStyles[key];
if (src && src !== defaultStyles[key] && src !== parStyles[key]) {
target.style[key] = src;
if (typeof src !== "string") continue; // invalid
if (defaultStyles[key] === true || src !== def) {
if (inheritableAttrs.indexOf(key) < 0 || src !== parStyles[key]) {
// special rule for inheritables
target.style[key] = src;
}
}

@@ -84,0 +97,0 @@ }

@@ -13,2 +13,6 @@ 'use strict';

// http://www.w3.org/TR/SVG/propidx.html
// via https://github.com/svg/svgo/blob/master/plugins/_collections.js
var inheritableAttrs = ['clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'transform', 'visibility', 'white-space', 'word-spacing', 'writing-mode'];
// Copies computed styles from source to target

@@ -42,5 +46,14 @@ /**

for (var key in defaultStyles) {
var def = defaultStyles[key];
if (def === false) continue; // copy never
var src = srcStyles[key];
if (src && src !== defaultStyles[key] && src !== parStyles[key]) {
target.style[key] = src;
if (typeof src !== "string") continue; // invalid
if (defaultStyles[key] === true || src !== def) {
if (inheritableAttrs.indexOf(key) < 0 || src !== parStyles[key]) {
// special rule for inheritables
target.style[key] = src;
}
}

@@ -47,0 +60,0 @@ }

7

package.json
{
"name": "copy-styles",
"version": "1.0.0",
"version": "1.1.0",
"description": "Copies computed styles from source to target",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"jsnext:main": "src/index.js",
"files": [

@@ -31,3 +31,4 @@ "dist/",

"css",
"getComputedStyles"
"getComputedStyles",
"dom"
],

@@ -34,0 +35,0 @@ "author": "J. Harshbarger <hypercubed@gmail.com>",

import computedStyles from 'computed-styles';
// http://www.w3.org/TR/SVG/propidx.html
// via https://github.com/svg/svgo/blob/master/plugins/_collections.js
const inheritableAttrs = [
'clip-rule',
'color',
'color-interpolation',
'color-interpolation-filters',
'color-profile',
'color-rendering',
'cursor',
'direction',
'fill',
'fill-opacity',
'fill-rule',
'font',
'font-family',
'font-size',
'font-size-adjust',
'font-stretch',
'font-style',
'font-variant',
'font-weight',
'glyph-orientation-horizontal',
'glyph-orientation-vertical',
'image-rendering',
'kerning',
'letter-spacing',
'marker',
'marker-end',
'marker-mid',
'marker-start',
'pointer-events',
'shape-rendering',
'stroke',
'stroke-dasharray',
'stroke-dashoffset',
'stroke-linecap',
'stroke-linejoin',
'stroke-miterlimit',
'stroke-opacity',
'stroke-width',
'text-anchor',
'text-rendering',
'transform',
'visibility',
'white-space',
'word-spacing',
'writing-mode'
];
// Copies computed styles from source to target

@@ -27,6 +77,15 @@ /**

for (let key in defaultStyles) {
var def = defaultStyles[key];
if (def === false) continue; // copy never
var src = srcStyles[key];
if (src && src !== defaultStyles[key] && src !== parStyles[key] ) {
target.style[key] = src;
if (typeof src !== "string") continue; // invalid
if (defaultStyles[key] === true || src !== def) {
if (inheritableAttrs.indexOf(key) < 0 || src !== parStyles[key]) { // special rule for inheritables
target.style[key] = src;
}
}
}

@@ -33,0 +92,0 @@ }

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