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,965
  • 2
  • 22
  • 30

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
  • 16,766
  • 21
  • 72
  • 104
0

Typo? I cannot think of any valid reason.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
0

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

Jakob Kruse
  • 2,458
  • 18
  • 17