[MapQuery] starting a widget API is wrong

Steven M. Ottens steven at minst.net
Fri Jul 1 07:50:57 EDT 2011


  On 7/1/2011 1:34 PM, Volker Mische wrote:
> On 07/01/2011 01:11 PM, Steven M. Ottens wrote:
>>   On 6/30/2011 4:15 PM, Volker Mische wrote:
>>> On 06/30/2011 12:05 PM, Anne Blankert wrote:
>>>> But until now, the idea of MapQuery is that it modifies the look and
>>>> behaviour of DOM elements instead of the look and behaviour of the map
>>>> element. For this reason I would stay with
>>>>    $("domselector").mqWidget(options)
>>>> and
>>>> $("domselector").mqWidget($("mapselector"))
>>>>
>> Hi all,
>>
>> Some more pondering resulted in the conclusion that this is not possible:
>>
>> $("domselector").mqWidget($("mapselector"))
>>
>> Because this approach will destroy the options object in the widget. So
>> all the default settings as set in the options object in the widget will
>> be destroyed as well.
>>
>> So I'd say the definitive API for widgets is:
>> $("domselector").mqWidget({map:"mapselector"})
>> I'll update the widgets and examples accordingly.
>>
>> (I don't like passing in the jQuery object like this:
>> $("domselector").mqWidget({map:$("mapselector")}) )
> But I think you can still pass in $("mapselector"), can't you?
> The "mapselector" will be just evaluated by jQuery. and I think jQuery
> can do things like $($("mapselector")).
>
> I'm not really interested in $("mapselector") that much, but rather in
> the possibility to pass in a DOM node (which should be possible as well).
Indeed, I just checked and using $(this.options.map) works for both 
this.options.map = '#map' and this.options.map = $('#map')

So I'll change the API docs that one should use 
$("domselector").mqWidget({options})  where {options} must contain map: 
'mapselector'

Steven



More information about the MapQuery mailing list