Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use class to hide SVG symbols #16832

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions js-packages/@fortawesome/fontawesome-svg-core/index.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -252,6 +252,7 @@ var _default = {
replacementClass: DEFAULT_REPLACEMENT_CLASS,
autoReplaceSvg: true,
autoAddCss: true,
symbolInlineCss: true,
autoA11y: true,
searchPseudoElements: false,
observeMutations: true,
Expand Down Expand Up @@ -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: {
style: 'display: none;'
},
attributes: attrs,
children: [{
tag: 'symbol',
attributes: _objectSpread({}, attributes, {
Expand Down
8 changes: 4 additions & 4 deletions js-packages/@fortawesome/fontawesome-svg-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -258,6 +258,7 @@
replacementClass: DEFAULT_REPLACEMENT_CLASS,
autoReplaceSvg: true,
autoAddCss: true,
symbolInlineCss: true,
autoA11y: true,
searchPseudoElements: false,
observeMutations: true,
Expand Down Expand Up @@ -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: {
style: 'display: none;'
},
attributes: attrs,
children: [{
tag: 'symbol',
attributes: _objectSpread({}, attributes, {
Expand Down
3 changes: 3 additions & 0 deletions js-packages/@fortawesome/fontawesome-svg-core/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ svg:not(:root).svg-inline--fa {
height: 2em;
width: 2.5em; }

.svg-symbol--fa {
display: none; }

.fa-inverse {
color: #fff; }

Expand Down