let getters receive multiple arguments:
http://github.com/mootools/mootools-core/blob/1.2/Source/Element/Element.js#L300

return the requested property:
http://github.com/mootools/mootools-core/blob/1.2/Source/Element/Element.js#L432
and
http://github.com/mootools/mootools-core/blob/1.2/Source/Element/Element.js#L620

You'll note the second link doesn't allow for a second argument, so no, I
don't think you could ever do (in 1.2 codebase) el.get('text', 'foo');

There were other custom getters that did allow for multiple arguments
though.



On Mon, Oct 25, 2010 at 3:16 PM, Sean McArthur <[email protected]>wrote:

> Looking in the 1.2 source code, I don't see anything about using a second
> variable for a default. I loaded up a website that's on 1.2.4, and tried
> passing a second value to Element.get, and did not receive back the
> "default" value (for the "text" property). I've also never heard of this
> ability before (besides the 'tween' property).
>
> Could it be that since the getter for Fx.Tween allowed defaults, some
> people assumed all properties did?
>
>
>
> On Mon, Oct 25, 2010 at 3:04 PM, Aaron Newton <[email protected]> wrote:
>
>> It was documented in several places indirectly. For example, the docs for
>> Fx.Tween gave the example (something to the effect of):
>>
>> el.get('tween', {defaults})
>>
>>
>> On Mon, Oct 25, 2010 at 2:50 PM, Sean McArthur <[email protected]>wrote:
>>
>>> I was unaware. I thought it might have been, so I checked the 1.2 docs,
>>> and it said nothing about passing a default value. So it must have been an
>>> undocumented feature?
>>>
>>>
>>>
>>>
>>> On Mon, Oct 25, 2010 at 2:46 PM, Aaron Newton <[email protected]> wrote:
>>>
>>>> No one in this thread seems to have said these magic words:
>>>>
>>>> this was a breaking change from MooTools 1.2 > 1.3.
>>>>
>>>>
>>>> On Mon, Oct 25, 2010 at 2:18 PM, André Fiedler <
>>>> [email protected]> wrote:
>>>>
>>>>> k, that´s bad. Used it a lot. ;o) Thanks so far
>>>>>
>>>>>
>>>>> 2010/10/25 Sean McArthur <[email protected]>
>>>>>
>>>>>> You don't pass a default. Thats not a behavior of MooTools (I know
>>>>>> Python dictionaries use the default value though).
>>>>>>
>>>>>> To get a default value, just use the OR (default) operator.
>>>>>>
>>>>>>  var text = myEl.get('text') || defaultText;
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Mon, Oct 25, 2010 at 2:13 PM, André Fiedler <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> So, if i now can get multiple values, how do i pass a default?
>>>>>>>
>>>>>>> 2010/10/25 André Fiedler <[email protected]>
>>>>>>>
>>>>>>> I thought the second parameter is the "default" if text isn´t set?
>>>>>>>>
>>>>>>>> 2010/10/25 Sean McArthur <[email protected]>
>>>>>>>>
>>>>>>>> Because you're calling Element.get with multiple arguments. If you
>>>>>>>>> do that, you'll get an object with key/value pairs, with each key 
>>>>>>>>> being one
>>>>>>>>> of the arguments you passed.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Oct 25, 2010 at 2:02 PM, André Fiedler <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>>  Why does this:
>>>>>>>>>>
>>>>>>>>>> http://jsfiddle.net/SunboX/Qhsej/
>>>>>>>>>>
>>>>>>>>>> return an Object like that:
>>>>>>>>>>
>>>>>>>>>> Object
>>>>>>>>>>
>>>>>>>>>>    1. : null
>>>>>>>>>>    2. text: "Go"
>>>>>>>>>>    3. __proto__: Object
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> using 1.3? It doesn´t using 1.2 instead?!
>>>>>>>>>>
>>>>>>>>>> Thx, André! :o)
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to