On Oct 20, 10:51 am, "Eric S." <
estrathme...@gmail.com> wrote:
> So, is this syntax used at all?
>
> $('namespace').concrete(function($){
> $('.selector').concrete({
> foo: function(){}
> ...
No. Have I used that in the docs? It's wrong :). Anything passed
directly to the $() function is a selector. The namespace is always
passed as the first argument to the concrete function - either
$.concrete(namespace, ... ) or $(selector).concrete(namespace, ...)
> Also, why does the dollar sign function have to be passed into the
> callback?
We override the $ function to return jQuery selection objects that
know what their namespace is. It's needed for both the internal
concrete definitions and for the lookup-in-namespace-before-base logic
If you did this (notice no $ argument to the function):
$.concrete('namespace', function(){
$('.selector').concrete({
foo: function(){ $('div').bar(); }
bar: function(){}
})
});
Then the second concrete call (the $('.selector').concrete one)
doesn't have any way of knowing what namespace to inject foo and bar
into, and the $('div').bar() call would also not know that bar should
be looked up in namespace first.
> I couldn't find the reasoning in the concrete docs.
Yeah. The docs still need some work, especially the reference portion.
Hamish Friedlander