var React = require('react');
var Events = require('../utils/events');
var Dom = require('../utils/dom');

module.exports = {

  //When the component mounts, listen to click events and check if we need to
  //Call the componentClickAway function.
  componentDidMount: function() {
    if (!this.manuallyBindClickAway) this._bindClickAway();
  },

  componentWillUnmount: function() {
    this._unbindClickAway();
  },

  _checkClickAway: function(e) {
    var el = React.findDOMNode(this); 
    
    // Check if the target is inside the current component
    if (this.isMounted() && 
      e.target != el &&
      !Dom.isDescendant(el, e.target) &&
      document.documentElement.contains(e.target)) {
      
      if (this.componentClickAway) this.componentClickAway();
    }
  },

  _bindClickAway: function() {
    Events.on(document, 'click', this._checkClickAway);
  },

  _unbindClickAway: function() {
    Events.off(document, 'click', this._checkClickAway);
  }

};

@@ -560,35 +560,8 @@
 if (
-this.isMounted() && %0A      
 e.ta
@@ -570,24 +570,26 @@
 et != el &&%0A
+  
       !Dom.i
@@ -623,16 +623,18 @@
 &%0A      
+  
 document
@@ -676,15 +676,8 @@
 ) %7B%0A
-      %0A
     

Update click-awayable.js, removing isMounted check