为什么 JSLint 说 jQuery 中缺少分号?

Why does JSLint say there is a missing semicolon in this jQuery?

以下是一些 JSLint 结果:

 1  finaffJS.module('custom_ribbon_buttons', ['jQuery'], function ($) {
 2      var my = {};
 3  
 4      my.insertLightBoxCloseDialog = function () {
 5          var url = $('#finaff-insert-lightbox-image-url').val();
 6          if (url) {
 7              var buttonHtml = '<a class="finaff-lightbox-link" href="' + encodeURI(url) + '"><div class="FinAff_View_Image_Button_Sprites FinAff_View_Image_Button">&#160;</div></a>';
 8              SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, buttonHtml);
 9          } else {
10              $('#finaff-insert-lightbox-image-url-flash').text('Need a URL');
11          }
12      }
13  
14      my.insertLightBoxClicked = function () {
    =^
    lint warning: missing semicolon

应该丢失的分号在哪里?

或者为什么 JSLint 会混淆?

您在第 12 行漏掉了分号:

 4      my.insertLightBoxCloseDialog = function () {
 5          var url = $('#finaff-insert-lightbox-image-url').val();
 6          if (url) {
 7              var buttonHtml = '<a class="finaff-lightbox-link" href="' + encodeURI(url) + '"><div class="FinAff_View_Image_Button_Sprites FinAff_View_Image_Button">&#160;</div></a>';
 8              SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, buttonHtml);
 9          } else {
10              $('#finaff-insert-lightbox-image-url-flash').text('Need a URL');
11          }
12      };

看一下第 2 行,您使用 {} 声明了一个变量,并且放置了一个分号。 insertLightBoxCloseDialog也需要,是一样的