mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 11:31:31 +08:00
DISABLE_THIRD_PARTY_CHECK=NPM fix R=jacktfranklin@chromium.org Bug: none Change-Id: I41baa3294f88b7e4463fdc580c050932c5abe40e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3372932 Reviewed-by: Jack Franklin <jacktfranklin@chromium.org> Commit-Queue: Tim Van der Lippe <tvanderlippe@chromium.org>
39 lines
925 B
JavaScript
39 lines
925 B
JavaScript
'use strict';
|
||
|
||
exports.name = 'removeNonInheritableGroupAttrs';
|
||
|
||
exports.type = 'perItem';
|
||
|
||
exports.active = true;
|
||
|
||
exports.description =
|
||
'removes non-inheritable group’s presentational attributes';
|
||
|
||
const {
|
||
inheritableAttrs,
|
||
attrsGroups,
|
||
presentationNonInheritableGroupAttrs,
|
||
} = require('./_collections');
|
||
|
||
/**
|
||
* Remove non-inheritable group's "presentation" attributes.
|
||
*
|
||
* @param {Object} item current iteration item
|
||
* @return {Boolean} if false, item will be filtered out
|
||
*
|
||
* @author Kir Belevich
|
||
*/
|
||
exports.fn = function (item) {
|
||
if (item.type === 'element' && item.name === 'g') {
|
||
for (const name of Object.keys(item.attributes)) {
|
||
if (
|
||
attrsGroups.presentation.includes(name) === true &&
|
||
inheritableAttrs.includes(name) === false &&
|
||
presentationNonInheritableGroupAttrs.includes(name) === false
|
||
) {
|
||
delete item.attributes[name];
|
||
}
|
||
}
|
||
}
|
||
};
|