From 62f346c6580d34c33b5a8758e7148ac0f99981cf Mon Sep 17 00:00:00 2001 From: Mikel Kew Date: Fri, 26 Jun 2020 00:29:50 +1000 Subject: [PATCH] Add `symbolInlineCss` configuration option --- js-packages/@fortawesome/fontawesome-svg-core/index.es.js | 8 ++++---- js-packages/@fortawesome/fontawesome-svg-core/index.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.es.js b/js-packages/@fortawesome/fontawesome-svg-core/index.es.js index 2e7efa505..33b747a12 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.es.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.es.js @@ -233,7 +233,7 @@ function coerce(val) { } if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') { - var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; + var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-symbol-inline-css', 'symbolInlineCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; attrs.forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), attr = _ref2[0], @@ -252,6 +252,7 @@ var _default = { replacementClass: DEFAULT_REPLACEMENT_CLASS, autoReplaceSvg: true, autoAddCss: true, + symbolInlineCss: true, autoA11y: true, searchPseudoElements: false, observeMutations: true, @@ -897,11 +898,10 @@ function asSymbol (_ref) { attributes = _ref.attributes, symbol = _ref.symbol; var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol; + var attrs = config.symbolInlineCss === true ? { style: 'display: none;' } : { class: 'svg-symbol--fa' }; return [{ tag: 'svg', - attributes: { - class: 'svg-symbol--fa' - }, + attributes: attrs, children: [{ tag: 'symbol', attributes: _objectSpread({}, attributes, { diff --git a/js-packages/@fortawesome/fontawesome-svg-core/index.js b/js-packages/@fortawesome/fontawesome-svg-core/index.js index 6cfc324ac..9efa154cb 100644 --- a/js-packages/@fortawesome/fontawesome-svg-core/index.js +++ b/js-packages/@fortawesome/fontawesome-svg-core/index.js @@ -239,7 +239,7 @@ } if (DOCUMENT && typeof DOCUMENT.querySelector === 'function') { - var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; + var attrs = [['data-family-prefix', 'familyPrefix'], ['data-replacement-class', 'replacementClass'], ['data-auto-replace-svg', 'autoReplaceSvg'], ['data-auto-add-css', 'autoAddCss'], ['data-symbol-inline-css', 'symbolInlineCss'], ['data-auto-a11y', 'autoA11y'], ['data-search-pseudo-elements', 'searchPseudoElements'], ['data-observe-mutations', 'observeMutations'], ['data-mutate-approach', 'mutateApproach'], ['data-keep-original-source', 'keepOriginalSource'], ['data-measure-performance', 'measurePerformance'], ['data-show-missing-icons', 'showMissingIcons']]; attrs.forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), attr = _ref2[0], @@ -258,6 +258,7 @@ replacementClass: DEFAULT_REPLACEMENT_CLASS, autoReplaceSvg: true, autoAddCss: true, + symbolInlineCss: true, autoA11y: true, searchPseudoElements: false, observeMutations: true, @@ -903,11 +904,10 @@ attributes = _ref.attributes, symbol = _ref.symbol; var id = symbol === true ? "".concat(prefix, "-").concat(config.familyPrefix, "-").concat(iconName) : symbol; + var attrs = config.symbolInlineCss === true ? { style: 'display: none;' } : { class: 'svg-symbol--fa' }; return [{ tag: 'svg', - attributes: { - class: 'svg-symbol--fa' - }, + attributes: attrs, children: [{ tag: 'symbol', attributes: _objectSpread({}, attributes, {