Skip to content

Commit 4b23a21

Browse files
committed
Linting.
1 parent a0c4bc6 commit 4b23a21

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/linkClass.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ let linkElement;
1111
linkElement = (element, styles, configuration) => {
1212
let appendClassName,
1313
elementIsFrozen,
14-
clonedElement,
15-
newChildren,
16-
newProps,
14+
elementShallowCopy,
1715
styleNames;
1816

19-
if (Object.isFrozen && Object.isFrozen(element)) {
17+
elementShallowCopy = element;
18+
19+
if (Object.isFrozen && Object.isFrozen(elementShallowCopy)) {
2020
elementIsFrozen = true;
2121

2222
// https://github.com/facebook/react/blob/v0.13.3/src/classic/element/ReactElement.js#L131
23-
element = objectUnfreeze(element);
24-
element.props = objectUnfreeze(element.props);
23+
elementShallowCopy = objectUnfreeze(elementShallowCopy);
24+
elementShallowCopy.props = objectUnfreeze(elementShallowCopy.props);
2525
}
2626

27-
styleNames = parseStyleName(element.props.styleName || '', configuration.allowMultiple);
27+
styleNames = parseStyleName(elementShallowCopy.props.styleName || '', configuration.allowMultiple);
2828

29-
if (React.isValidElement(element.props.children)) {
30-
element.props.children = linkElement(React.Children.only(element.props.children), styles, configuration);
31-
} else if (_.isArray(element.props.children) || isIterable(element.props.children)) {
32-
element.props.children = React.Children.map(element.props.children, (node) => {
29+
if (React.isValidElement(elementShallowCopy.props.children)) {
30+
elementShallowCopy.props.children = linkElement(React.Children.only(elementShallowCopy.props.children), styles, configuration);
31+
} else if (_.isArray(elementShallowCopy.props.children) || isIterable(elementShallowCopy.props.children)) {
32+
elementShallowCopy.props.children = React.Children.map(elementShallowCopy.props.children, (node) => {
3333
if (React.isValidElement(node)) {
3434
return linkElement(node, styles, configuration);
3535
} else {
@@ -41,20 +41,20 @@ linkElement = (element, styles, configuration) => {
4141
if (styleNames.length) {
4242
appendClassName = generateAppendClassName(styles, styleNames, configuration.errorWhenNotFound);
4343

44-
if (element.props.className) {
45-
appendClassName = element.props.className + ' ' + appendClassName;
44+
if (elementShallowCopy.props.className) {
45+
appendClassName = elementShallowCopy.props.className + ' ' + appendClassName;
4646
}
4747

48-
element.props.className = appendClassName;
49-
element.props.styleName = null;
48+
elementShallowCopy.props.className = appendClassName;
49+
elementShallowCopy.props.styleName = null;
5050
}
5151

5252
if (elementIsFrozen) {
53-
Object.freeze(element);
54-
Object.freeze(element.props);
53+
Object.freeze(elementShallowCopy.props);
54+
Object.freeze(elementShallowCopy);
5555
}
5656

57-
return element;
57+
return elementShallowCopy;
5858
};
5959

6060
/**

0 commit comments

Comments
 (0)