I don't think you can concat or use var replacement when defining the key in
new objects in javascript.

That is why the original prototype author defined styles in two statements.

style = $extend({
       "float": a,
       marginTop: this.closeDimensions[s].height + 'px'
}
style["padding" + a.capitalize()] = this.border + 'px';



The following should work:

someEl.setStyles({
   'float' : a,
   'margin-top' : this.closeDimensions[s].height
}).setStyle('padding'+a.capitalize(), this.border);




On Fri, Apr 17, 2009 at 7:19 AM, Thierry bela nanga <bna...@gmail.com>wrote:

> or maybe you should change the '=' to ':'
> I think you miss that.
>
>
> On Fri, Apr 17, 2009 at 3:18 PM, Thierry bela nanga <bna...@gmail.com>wrote:
>
>> someEl.setStyles({
>>     'float': a,
>>     'margin-top': this.closeDimensions[s].height + 'px',
>> //property is missing here
>>     'padding' + a.capitalize() = this.border + 'px'
>> });
>>
>> the property name is missing in the last line
>>
>>
>> On Fri, Apr 17, 2009 at 3:09 PM, keif <god.dre...@gmail.com> wrote:
>>
>>>
>>> I'm porting a function from prototype, and something the original
>>> author does (that seems to break in MooTools) is do:
>>> style = $extend({
>>>        "float": a,
>>>        marginTop: this.closeDimensions[s].height + 'px'
>>> }
>>> style["padding" + a.capitalize()] = this.border + 'px';
>>> someEl.setStyle({style});
>>>
>>> so MooTools chokes on using an object to set the styles - I *am*
>>> converting setStyle to setStyles({style}), and broke it down to:
>>>
>>> someEl.setStyles({
>>>        'float': a,
>>>        'margin-top': this.closeDimensions[s].height + 'px',
>>>        'padding' + a.capitalize() = this.border + 'px'
>>> });
>>>
>>> and it throws an error on the third style saying it's missing a ':'
>>> after the property ID.
>>>
>>> Any ideas? TIA.
>>
>>
>>
>>
>> --
>> fax : (+33) 08 26 51 94 51
>>
>
>
>
> --
> fax : (+33) 08 26 51 94 51
>

Reply via email to