Skip to content

Commit

Permalink
Added '|| 0' fallback in case getComputedStyle() returns empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Lane committed Feb 19, 2016
1 parent f6f89d4 commit add2aff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ let Autocomplete = React.createClass({
var node = this.refs.input
var rect = node.getBoundingClientRect()
var computedStyle = global.window.getComputedStyle(node)
var marginBottom = parseInt(computedStyle.marginBottom, 10)
var marginLeft = parseInt(computedStyle.marginLeft, 10)
var marginRight = parseInt(computedStyle.marginRight, 10)
var marginBottom = parseInt(computedStyle.marginBottom, 10) || 0;
var marginLeft = parseInt(computedStyle.marginLeft, 10) || 0;
var marginRight = parseInt(computedStyle.marginRight, 10) || 0;
this.setState({
menuTop: rect.bottom + marginBottom,
menuLeft: rect.left + marginLeft,
Expand Down

0 comments on commit add2aff

Please sign in to comment.