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

@fortawesome/fontawesome-svg-core

Package Overview
Dependencies
Maintainers
4
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fortawesome/fontawesome-svg-core - npm Package Compare versions

Comparing version 1.2.0-8 to 1.2.0-9

119

index.es.js
/*!
* Font Awesome Free 5.1.0-5 by @fontawesome - https://fontawesome.com
* Font Awesome Free 5.1.0-6 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)

@@ -37,4 +37,6 @@ */

var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
var DATA_PREFIX = 'data-prefix';
var DATA_ICON = 'data-icon';
var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ["HTML", "HEAD", "STYLE", "SCRIPT"];
var PRODUCTION = function () {

@@ -120,3 +122,2 @@ try {

searchPseudoElements: false,
searchPseudoElementsMax: 1000,
observeMutations: true,

@@ -609,3 +610,3 @@ keepOriginalSource: true,

var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
var preamble = 'FA "5.1.0-5"';
var preamble = 'FA "5.1.0-6"';

@@ -1106,2 +1107,12 @@ var begin = function begin(name) {

var blankMeta = {
iconName: null,
title: null,
prefix: null,
transform: meaninglessTransform,
symbol: false,
mask: null,
extra: { classes: [], styles: {}, attributes: {} }
};
function parseMeta(node) {

@@ -1121,3 +1132,3 @@ var _classParser = classParser(node),

iconName: iconName,
title: node.getAttribute('title'),
title: node.getAttribute("title"),
prefix: prefix,

@@ -1292,10 +1303,2 @@ transform: transform,

function remove(node) {
if (typeof node.remove === 'function') {
node.remove();
} else if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
}
function searchPseudoElements(root) {

@@ -1307,34 +1310,56 @@ if (!IS_DOM) return;

disableObservation(function () {
var allNodes = root.querySelectorAll('*');
if (allNodes.length > config.searchPseudoElementsMax) {
console.error('WARNING: Font Awesome is stopping its search for pseudo elements to ' + ('transform into icons\nbecause this document has ' + allNodes.length + ' nodes in it and ') + ('the maximum size allowed is currently ' + config.searchPseudoElementsMax + '.\nYou can ') + 'configure this limit by changing searchPseudoElementsMax in the Font Awesome config.\n' + 'Be careful, though, setting this limit too high with a large DOM could result in terrible ' + 'performance, possibly hanging the browser.');
return;
}
toArray(allNodes).forEach(function (node) {
toArray(root.querySelectorAll('*')).filter(function (n) {
return n.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(n.tagName.toUpperCase()) && !n.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!n.parentNode || n.parentNode.tagName !== 'svg');
}).forEach(function (node) {
[':before', ':after'].forEach(function (pos) {
var styles = WINDOW.getComputedStyle(node, pos);
var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
var children = toArray(node.children);
var pseudoElement = children.filter(function (c) {
var alreadyProcessedPseudoElement = children.filter(function (c) {
return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === pos;
})[0];
if (pseudoElement) {
if (pseudoElement.nextSibling && pseudoElement.nextSibling.textContent.indexOf(DATA_FA_PSEUDO_ELEMENT) > -1) {
remove(pseudoElement.nextSibling);
}
remove(pseudoElement);
pseudoElement = null;
}
var styles = WINDOW.getComputedStyle(node, pos);
var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
if (fontFamily && !pseudoElement) {
if (alreadyProcessedPseudoElement && !fontFamily) {
// If we've already processed it but the current computed style does not result in a font-family,
// that probably means that a class name that was previously present to make the icon has been
// removed. So we now should delete the icon.
node.removeChild(alreadyProcessedPseudoElement);
} else if (fontFamily) {
var content = styles.getPropertyValue('content');
var i = DOCUMENT.createElement('i');
i.setAttribute('class', '' + STYLE_TO_PREFIX[fontFamily[1]]);
i.setAttribute(DATA_FA_PSEUDO_ELEMENT, pos);
i.innerText = content.length === 3 ? content.substr(1, 1) : content;
if (pos === ':before') {
node.insertBefore(i, node.firstChild);
} else {
node.appendChild(i);
var prefix = STYLE_TO_PREFIX[fontFamily[1]];
var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content));
// Only convert the pseudo element in this :before/:after position into an icon if we haven't
// already done so with the same prefix and iconName
if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
if (alreadyProcessedPseudoElement) {
// Delete the old one, since we're replacing it with a new one
node.removeChild(alreadyProcessedPseudoElement);
}
var extra = blankMeta.extra;
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = pos;
var abstract = makeInlineSvgAbstract(_extends({}, blankMeta, {
icons: {
main: findIcon(iconName, prefix),
mask: emptyCanonicalIcon()
},
prefix: prefix,
iconName: iconName,
extra: extra,
watchable: true
}));
var element = DOCUMENT.createElement('svg');
if (pos === ':before') {
node.insertBefore(element, node.firstChild);
} else {
node.appendChild(element);
}
element.outerHTML = abstract.map(function (a) {
return toHtml(a);
}).join('\n');
}

@@ -1533,14 +1558,7 @@ }

var _cssInserted = false;
function ensureCss() {
if (!config.autoAddCss) {
return;
}
if (!_cssInserted) {
if (config.autoAddCss && !_cssInserted) {
insertCss(css());
_cssInserted = true;
}
_cssInserted = true;
}

@@ -1611,2 +1629,4 @@

var _cssInserted = false;
var dom = {

@@ -1636,3 +1656,6 @@ i2svg: function i2svg() {

insertCss: function insertCss$$1() {
insertCss(css());
if (!_cssInserted) {
insertCss(css());
_cssInserted = true;
}
},

@@ -1639,0 +1662,0 @@

/*!
* Font Awesome Free 5.1.0-5 by @fontawesome - https://fontawesome.com
* Font Awesome Free 5.1.0-6 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)

@@ -43,4 +43,6 @@ */

var DATA_FA_PSEUDO_ELEMENT = 'data-fa-pseudo-element';
var DATA_PREFIX = 'data-prefix';
var DATA_ICON = 'data-icon';
var HTML_CLASS_I2SVG_BASE_CLASS = 'fontawesome-i2svg';
var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ["HTML", "HEAD", "STYLE", "SCRIPT"];
var PRODUCTION = function () {

@@ -126,3 +128,2 @@ try {

searchPseudoElements: false,
searchPseudoElementsMax: 1000,
observeMutations: true,

@@ -615,3 +616,3 @@ keepOriginalSource: true,

var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : { mark: noop$2, measure: noop$2 };
var preamble = 'FA "5.1.0-5"';
var preamble = 'FA "5.1.0-6"';

@@ -1112,2 +1113,12 @@ var begin = function begin(name) {

var blankMeta = {
iconName: null,
title: null,
prefix: null,
transform: meaninglessTransform,
symbol: false,
mask: null,
extra: { classes: [], styles: {}, attributes: {} }
};
function parseMeta(node) {

@@ -1127,3 +1138,3 @@ var _classParser = classParser(node),

iconName: iconName,
title: node.getAttribute('title'),
title: node.getAttribute("title"),
prefix: prefix,

@@ -1298,10 +1309,2 @@ transform: transform,

function remove(node) {
if (typeof node.remove === 'function') {
node.remove();
} else if (node && node.parentNode) {
node.parentNode.removeChild(node);
}
}
function searchPseudoElements(root) {

@@ -1313,34 +1316,56 @@ if (!IS_DOM) return;

disableObservation(function () {
var allNodes = root.querySelectorAll('*');
if (allNodes.length > config.searchPseudoElementsMax) {
console.error('WARNING: Font Awesome is stopping its search for pseudo elements to ' + ('transform into icons\nbecause this document has ' + allNodes.length + ' nodes in it and ') + ('the maximum size allowed is currently ' + config.searchPseudoElementsMax + '.\nYou can ') + 'configure this limit by changing searchPseudoElementsMax in the Font Awesome config.\n' + 'Be careful, though, setting this limit too high with a large DOM could result in terrible ' + 'performance, possibly hanging the browser.');
return;
}
toArray(allNodes).forEach(function (node) {
toArray(root.querySelectorAll('*')).filter(function (n) {
return n.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(n.tagName.toUpperCase()) && !n.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!n.parentNode || n.parentNode.tagName !== 'svg');
}).forEach(function (node) {
[':before', ':after'].forEach(function (pos) {
var styles = WINDOW.getComputedStyle(node, pos);
var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
var children = toArray(node.children);
var pseudoElement = children.filter(function (c) {
var alreadyProcessedPseudoElement = children.filter(function (c) {
return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === pos;
})[0];
if (pseudoElement) {
if (pseudoElement.nextSibling && pseudoElement.nextSibling.textContent.indexOf(DATA_FA_PSEUDO_ELEMENT) > -1) {
remove(pseudoElement.nextSibling);
}
remove(pseudoElement);
pseudoElement = null;
}
var styles = WINDOW.getComputedStyle(node, pos);
var fontFamily = styles.getPropertyValue('font-family').match(FONT_FAMILY_PATTERN);
if (fontFamily && !pseudoElement) {
if (alreadyProcessedPseudoElement && !fontFamily) {
// If we've already processed it but the current computed style does not result in a font-family,
// that probably means that a class name that was previously present to make the icon has been
// removed. So we now should delete the icon.
node.removeChild(alreadyProcessedPseudoElement);
} else if (fontFamily) {
var content = styles.getPropertyValue('content');
var i = DOCUMENT.createElement('i');
i.setAttribute('class', '' + STYLE_TO_PREFIX[fontFamily[1]]);
i.setAttribute(DATA_FA_PSEUDO_ELEMENT, pos);
i.innerText = content.length === 3 ? content.substr(1, 1) : content;
if (pos === ':before') {
node.insertBefore(i, node.firstChild);
} else {
node.appendChild(i);
var prefix = STYLE_TO_PREFIX[fontFamily[1]];
var iconName = byUnicode(prefix, toHex(content.length === 3 ? content.substr(1, 1) : content));
// Only convert the pseudo element in this :before/:after position into an icon if we haven't
// already done so with the same prefix and iconName
if (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconName) {
if (alreadyProcessedPseudoElement) {
// Delete the old one, since we're replacing it with a new one
node.removeChild(alreadyProcessedPseudoElement);
}
var extra = blankMeta.extra;
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = pos;
var abstract = makeInlineSvgAbstract(_extends({}, blankMeta, {
icons: {
main: findIcon(iconName, prefix),
mask: emptyCanonicalIcon()
},
prefix: prefix,
iconName: iconName,
extra: extra,
watchable: true
}));
var element = DOCUMENT.createElement('svg');
if (pos === ':before') {
node.insertBefore(element, node.firstChild);
} else {
node.appendChild(element);
}
element.outerHTML = abstract.map(function (a) {
return toHtml(a);
}).join('\n');
}

@@ -1539,14 +1564,7 @@ }

var _cssInserted = false;
function ensureCss() {
if (!config.autoAddCss) {
return;
}
if (!_cssInserted) {
if (config.autoAddCss && !_cssInserted) {
insertCss(css());
_cssInserted = true;
}
_cssInserted = true;
}

@@ -1617,2 +1635,4 @@

var _cssInserted = false;
var dom = {

@@ -1642,3 +1662,6 @@ i2svg: function i2svg() {

insertCss: function insertCss$$1() {
insertCss(css());
if (!_cssInserted) {
insertCss(css());
_cssInserted = true;
}
},

@@ -1645,0 +1668,0 @@

@@ -50,5 +50,5 @@ {

"dependencies": {
"@fortawesome/fontawesome-common-types": "^0.2.0-3"
"@fortawesome/fontawesome-common-types": "^0.2.0-4"
},
"version": "1.2.0-8",
"version": "1.2.0-9",
"name": "@fortawesome/fontawesome-svg-core",

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

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