Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove redundant check for existence of el.style
  • Loading branch information
acdlite committed Oct 18, 2018
commit 8615ab47abfeff00b7a3711d562c0c9cd9dc993b
24 changes: 10 additions & 14 deletions packages/react-dom/src/client/ReactDOMHostConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,7 @@ export function hideInstance(instance: Instance): void {
// TODO: Does this work for all element types? What about MathML? Should we
// pass host context to this method?
instance = ((instance: any): HTMLElement);
if (instance.style !== undefined && instance.style !== null) {
instance.style.display = 'none';
}
instance.style.display = 'none';
}

export function hideTextInstance(textInstance: TextInstance): void {
Expand All @@ -431,17 +429,15 @@ export function hideTextInstance(textInstance: TextInstance): void {

export function unhideInstance(instance: Instance, props: Props): void {
instance = ((instance: any): HTMLElement);
if (instance.style !== undefined && instance.style !== null) {
let display = null;
if (props[STYLE] !== undefined && props[STYLE] !== null) {
const styleProp = props[STYLE];
if (styleProp.hasOwnProperty('display')) {
display = styleProp.display;
}
}
// $FlowFixMe Setting a style property to null is the valid way to reset it.
instance.style.display = display;
}
const styleProp = props[STYLE];
const display =
styleProp !== undefined &&
styleProp !== null &&
styleProp.hasOwnProperty('display')
? styleProp.display
: null;
// $FlowFixMe Setting a style property to null is the valid way to reset it.
instance.style.display = display;
}

export function unhideTextInstance(
Expand Down