diff --git a/src/enhanced-button.jsx b/src/enhanced-button.jsx index 93ab00d8414ba7..c2503f06c3372a 100644 --- a/src/enhanced-button.jsx +++ b/src/enhanced-button.jsx @@ -195,9 +195,12 @@ const EnhancedButton = React.createClass({ }; const buttonChildren = this._createButtonChildren(); + // Provides backward compatibity. Added to support wrapping around element. + const targetLinkElement = buttonProps.hasOwnProperty('href') ? 'a' : 'span'; + return React.isValidElement(containerElement) ? React.cloneElement(containerElement, buttonProps, buttonChildren) : - React.createElement(linkButton ? 'a' : containerElement, buttonProps, buttonChildren); + React.createElement(linkButton ? targetLinkElement : containerElement, buttonProps, buttonChildren); },