3

I was looking at some jQuery UI code, a found a weird behavior there:

jQuery.ui||(function(a){ /*... */ })(jQuery);;

The logical OR is clear for me, the function wrapper (still searching the correct name for it), too, but why two semicolons?

Thanks in advance

Vincent

EDIT: Just found a another weird thing: In the version on google apis is only one semicolon. But when you create your on build on http://jqueryui.com/download, there are two semicolons.

Vincent
  • 3,906
  • 2
  • 21
  • 29

3 Answers3

1

Breaking it down:

// make sure that any previous statements are properly closed
// this is handy when concatenating files, for example
; 
// Call the jQuery.ui object, or, if it does not exist, create it
jQuery.ui || (function($) { 

reference

Community
  • 1
  • 1
AlexStack
  • 15,377
  • 18
  • 69
  • 102
0

Typo? I cannot think of any valid reason.

Diodeus - James MacFarlane
  • 110,221
  • 32
  • 151
  • 174
0

That must either be a bug or a misunderstanding. Two consecutive semicolons do not make sense.

Jakob Kruse
  • 2,358
  • 17
  • 17