I'm debugging a piece of jquery and found this snippet which i don't understand.
Would someone mind breaking it down so that I can research the individual parts?
window.specific = $('.' + specific_class);
specific is defined in "window scope" outside the function. specific_class would have some class name in it and it is used in jQuery selector and matched elements are assigned to window.specific.
window.specific = "";
specific_class = 'someclass';
function myfun()
{
window.specific = $('.' + specific_class);
}
This sets the 'specific' property of the window object to a class defined by the specific_class variable.
Let's say that the specific_class variable contained the text 'myClass', then window.specific would be equal to:-
window.specific = $('.myClass');
Which in turn would refer to all instances of the myClass class.
window., the variable will be globally defined. This makes it easier to debug the variable's value (via the console, for instance).