Skip to content

Commit

Permalink
Merge pull request #623 from pomerantsev/find-dom-node
Browse files Browse the repository at this point in the history
Replace all instances of getDOMNode with findDOMNode
  • Loading branch information
Hai Nguyen committed May 10, 2015
2 parents 9b9f222 + 009503c commit 626c0b0
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/drop-down-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ var DropDownMenu = React.createClass({

_setWidth: function() {
var el = React.findDOMNode(this),
menuItemsDom = this.refs.menuItems.getDOMNode();
menuItemsDom = React.findDOMNode(this.refs.menuItems);

el.style.width = menuItemsDom.offsetWidth + 'px';
},
Expand Down Expand Up @@ -200,4 +200,4 @@ var DropDownMenu = React.createClass({

});

module.exports = DropDownMenu;
module.exports = DropDownMenu;
4 changes: 2 additions & 2 deletions src/enhanced-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ var EnhancedButton = React.createClass({
},

_handleFocus: function(e) {
this.getDOMNode().style.outline = 'none';
React.findDOMNode(this).style.outline = 'none';
if (!this.props.disabled) {
//setTimeout is needed because the focus event fires first
//Wait so that we can capture if this was a keyboard focus
Expand All @@ -204,7 +204,7 @@ var EnhancedButton = React.createClass({
},

_handleMouseOver: function(e) {
this.getDOMNode().style.textDecoration = 'none';
React.findDOMNode(this).style.textDecoration = 'none';
if (this.props.onMouseOver) this.props.onMouseOver(e);
},

Expand Down
4 changes: 2 additions & 2 deletions src/flat-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ var FlatButton = React.createClass({
_handleKeyboardFocus: function(e, keyboardFocused) {

if (keyboardFocused && !this.props.disabled) {
this.getDOMNode().style.backgroundColor = ColorManipulator.fade(ColorManipulator.lighten(this.getStyles().root.color, 0.4), 0.15);
React.findDOMNode(this).style.backgroundColor = ColorManipulator.fade(ColorManipulator.lighten(this.getStyles().root.color, 0.4), 0.15);
} else {
this.getDOMNode().style.backgroundColor = 'transparent';
React.findDOMNode(this).style.backgroundColor = 'transparent';
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/left-nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ var LeftNav = React.createClass({

_updateMenuHeight: function() {
if (this.props.header) {
var container = this.refs.clickAwayableElement.getDOMNode();
var menu = this.refs.menuItems.getDOMNode();
var container = React.findDOMNode(this.refs.clickAwayableElement);
var menu = React.findDOMNode(this.refs.menuItems);
var menuHeight = container.clientHeight - menu.offsetTop;
menu.style.height = menuHeight + 'px';
}
Expand Down
2 changes: 1 addition & 1 deletion src/menu/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var NestedMenuItem = React.createClass({

_positionNestedMenu: function() {
// <<<<<<< HEAD:src/menu/menu.jsx
var el = this.getDOMNode();
var el = React.findDOMNode(this);
var nestedMenu = React.findDOMNode(this.refs.nestedMenu);
// =======
// var el = React.findDOMNode(this),
Expand Down
6 changes: 3 additions & 3 deletions src/raised-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,12 @@ var RaisedButton = React.createClass({
if (keyboardFocused && !this.props.disabled) {
this.setState({ zDepth: this.state.initialZDepth + 1 });
var amount = (this.props.primary || this.props.secondary) ? 0.4 : 0.08;
this.refs.overlay.getDOMNode().style.backgroundColor = ColorManipulator.fade(this.mergeAndPrefix(this.styles.label, this.props.labelStyle).color, amount);
React.findDOMNode(this.refs.overlay).style.backgroundColor = ColorManipulator.fade(this.mergeAndPrefix(this.styles.label, this.props.labelStyle).color, amount);
} else if (!this.state.hovered) {
this.setState({ zDepth: this.state.initialZDepth });
this.refs.overlay.getDOMNode().style.backgroundColor = 'transparent';
React.findDOMNode(this.refs.overlay).style.backgroundColor = 'transparent';
}
},
});

module.exports = RaisedButton;
module.exports = RaisedButton;
3 changes: 1 addition & 2 deletions src/time-picker/clock-hours.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var ClockHours = React.createClass({
},

componentDidMount: function () {
var clockElement = this.refs.mask.getDOMNode();
var clockElement = React.findDOMNode(this.refs.mask);

this.center = {
x: clockElement.offsetWidth / 2,
Expand Down Expand Up @@ -175,4 +175,3 @@ var ClockHours = React.createClass({
});

module.exports = ClockHours;

3 changes: 1 addition & 2 deletions src/time-picker/clock-minutes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var ClockMinutes = React.createClass({
},

componentDidMount: function () {
var clockElement = this.refs.mask.getDOMNode();
var clockElement = React.findDOMNode(this.refs.mask);

this.center = {
x: clockElement.offsetWidth / 2,
Expand Down Expand Up @@ -158,4 +158,3 @@ var ClockMinutes = React.createClass({
});

module.exports = ClockMinutes;

8 changes: 4 additions & 4 deletions src/transition-groups/slide-in-child.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var SlideInChild = React.createClass({
},

componentWillEnter: function(callback) {
var style = this.getDOMNode().style;
var style = React.findDOMNode(this).style;
var x = this.props.direction === 'left' ? '100%' :
this.props.direction === 'right' ? '-100%' : '0';
var y = this.props.direction === 'up' ? '100%' :
Expand All @@ -28,13 +28,13 @@ var SlideInChild = React.createClass({
},

componentDidEnter: function() {
var style = this.getDOMNode().style;
var style = React.findDOMNode(this).style;
style.opacity = '1';
AutoPrefix.set(style, 'transform', 'translate3d(0,0,0)');
},

componentWillLeave: function(callback) {
var style = this.getDOMNode().style;
var style = React.findDOMNode(this).style;
var direction = this.props.getLeaveDirection();
var x = direction === 'left' ? '-100%' :
direction === 'right' ? '100%' : '0';
Expand Down Expand Up @@ -72,4 +72,4 @@ var SlideInChild = React.createClass({

});

module.exports = SlideInChild;
module.exports = SlideInChild;

0 comments on commit 626c0b0

Please sign in to comment.