jquery.color.js内のメソッドに関して質問なのですが、
下記のソースの戻り値で実体化しているjQuery.Color.fn.parseは、color(color.fn)のprototype内のparseプロパティと同じものなのでしょうか。
javascript
1 color = jQuery.Color = function( color, green, blue, alpha ) { 2 3 return new jQuery.Color.fn.parse( color, green, blue, alpha ); 4 }, 5<略> 6color.fn = jQuery.extend( color.prototype, { 7 parse: function( red, green, blue, alpha ) { 8 if ( red === undefined ) { 9 this._rgba = [ null, null, null, null ]; 10 return this; 11 } 12 if ( red.jquery || red.nodeType ) { 13 red = jQuery( red ).css( green ); 14 green = undefined; 15 } 16 17 var inst = this, 18 type = jQuery.type( red ), 19 rgba = this._rgba = []; 20 21 // more than 1 argument specified - assume ( red, green, blue, alpha ) 22 if ( green !== undefined ) { 23 red = [ red, green, blue, alpha ]; 24 type = "array"; 25 } 26 27 if ( type === "string" ) { 28 return this.parse( stringParse( red ) || colors._default ); 29 } 30 31 if ( type === "array" ) { 32 each( spaces.rgba.props, function( key, prop ) { 33 rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); 34 }); 35 return this; 36 } 37 if ( type === "object" ) { 38 if ( red instanceof color ) { 39 each( spaces, function( spaceName, space ) { 40 if ( red[ space.cache ] ) { 41 inst[ space.cache ] = red[ space.cache ].slice(); 42 } 43 }); 44 } else { 45 each( spaces, function( spaceName, space ) { 46 var cache = space.cache; 47 each( space.props, function( key, prop ) { 48 49 // if the cache doesn't exist, and we know how to convert 50 if ( !inst[ cache ] && space.to ) { 51 52 // if the value was null, we don't need to copy it 53 // if the key was alpha, we don't need to copy it either 54 if ( key === "alpha" || red[ key ] == null ) { 55 return; 56 } 57 inst[ cache ] = space.to( inst._rgba ); 58 } 59 60 // this is the only case where we allow nulls for ALL properties. 61 // call clamp with alwaysAllowEmpty 62 inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); 63 }); 64 65 // everything defined but alpha? 66 if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { 67 // use the default of 1 68 inst[ cache ][ 3 ] = 1; 69 if ( space.from ) { 70 inst._rgba = space.from( inst[ cache ] ); 71 } 72 } 73 }); 74 } 75 return this; 76 } 77 },
jquery.color全体のソース
https://github.com/jquery/jquery-color
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。