1- ; ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; throw new Error ( "Cannot find module '" + o + "'" ) } var f = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( f . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , f , f . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
2- var isPlaceholderSupported = ( typeof document !== 'undefined' ) && 'placeholder' in document . createElement ( 'input' ) ;
1+ ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; throw new Error ( "Cannot find module '" + o + "'" ) } var f = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( f . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , f , f . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
2+ var isPlaceholderSupported = ( typeof document !== 'undefined' )
3+ && 'placeholder' in document . createElement ( 'input' ) ;
34
45/**
56 * Input is a wrapper around React.DOM.input with a `placeholder` shim for IE9.
@@ -12,6 +13,7 @@ var createShimmedElement = function(React, elementConstructor, name) {
1213 componentWillMount : function ( ) {
1314 this . needsPlaceholding = this . props . placeholder && ! isPlaceholderSupported ;
1415 } ,
16+
1517 componentWillReceiveProps : function ( props ) {
1618 this . needsPlaceholding = props . placeholder && ! isPlaceholderSupported ;
1719 } ,
@@ -56,17 +58,13 @@ var createShimmedElement = function(React, elementConstructor, name) {
5658 } ,
5759
5860 setSelectionIfNeeded : function ( node ) {
59- // if placeholder is visible, ensure cursor is at start of input
60- if ( this . needsPlaceholding &&
61- this . hasFocus &&
62- this . isPlaceholding &&
63- ( node . selectionStart !== 0 || node . selectionEnd !== 0 ) ) {
61+ if ( this . needsPlaceholding
62+ && 'setSelectionRange' in node
63+ && this . hasFocus
64+ && this . isPlaceholding
65+ && ( node . selectionStart !== 0 || node . selectionEnd !== 0 ) ) {
6466 node . setSelectionRange ( 0 , 0 ) ;
65-
66- return true ;
67- }
68-
69- return false ;
67+ } // if placeholder is visible, ensure cursor is at start of input
7068 } ,
7169
7270 onChange : function ( e ) {
@@ -104,38 +102,42 @@ var createShimmedElement = function(React, elementConstructor, name) {
104102 } ,
105103
106104 render : function ( ) {
107- var element ;
105+ var props = { } ;
108106 var value ;
107+ var key ;
109108
110- if ( ! ( 'createElement' in React ) ) { /* start -- to be removed in 2.0.0 */
111- element = this . transferPropsTo ( elementConstructor ( ) ) ;
112- } else { /* -- end */
113- element = React . createElement ( elementConstructor , this . props , this . props . children ) ;
109+ for ( key in this . props ) {
110+ if ( this . props . hasOwnProperty ( key ) ) {
111+ props [ key ] = this . props [ key ] ;
112+ }
114113 }
115114
116115 if ( this . needsPlaceholding ) {
117116 // override valueLink and event handlers
118- element . props . onFocus = this . onFocus ;
119- element . props . onBlur = this . onBlur ;
120- element . props . onChange = this . onChange ;
121- element . props . onSelect = this . onSelect ;
122- element . props . valueLink = undefined ;
117+ props . onFocus = this . onFocus ;
118+ props . onBlur = this . onBlur ;
119+ props . onChange = this . onChange ;
120+ props . onSelect = this . onSelect ;
121+ props . valueLink = undefined ;
123122
124123 value = this . getValue ( ) ;
125124
126125 if ( ! value ) {
127126 this . isPlaceholding = true ;
128127 value = this . props . placeholder ;
129- element . props . type = 'text' ;
130- element . props . className += ' placeholder' ;
128+ props . className += ' placeholder' ;
131129 } else {
132130 this . isPlaceholding = false ;
133131 }
134132
135- element . props . value = value ;
133+ props . value = value ;
136134 }
137135
138- return element ;
136+ if ( ! ( 'createElement' in React ) ) { /* start -- to be removed in 2.0.0 */
137+ return this . transferPropsTo ( elementConstructor ( ) ) ;
138+ } else { /* -- end */
139+ return React . createElement ( elementConstructor , props , this . props . children ) ;
140+ }
139141 }
140142 } ) ;
141143} ;
@@ -148,8 +150,8 @@ module.exports = function(React) {
148150 } ;
149151 } else { /* -- end */
150152 return {
151- Input : React . createFactory ( createShimmedElement ( React , 'input' , 'Input' ) ) ,
152- Textarea : React . createFactory ( createShimmedElement ( React , 'textarea' , 'Textarea' ) )
153+ Input : createShimmedElement ( React , 'input' , 'Input' ) ,
154+ Textarea : createShimmedElement ( React , 'textarea' , 'Textarea' )
153155 } ;
154156 }
155157} ;
@@ -164,5 +166,4 @@ if (typeof define === 'function' && define.amd) {
164166} else {
165167 window . PlaceholderShim = reactInputPlaceholder ( window . React ) ;
166168}
167- } , { "./react-input-placeholder" :1 } ] } , { } , [ 2 ] )
168- ;
169+ } , { "./react-input-placeholder" :1 } ] } , { } , [ 2 ] )
0 commit comments