У меня есть некоторые вопросы о jquery plugin - bootstrap-popover.js.
- ! Function ($) {// Значение?
- Некоторые линии не имеют точки с запятой и запятой, почему?
- } (window.jQuery); // имея в виду?
!function ($) { //<--- 1. what does this line mean?
"use strict"; // jshint ;_;
var Popover = function (element, options) {
this.init('popover', element, options) //<-- 2. this line has no semicolon, why...?
}
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
..................................
})
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function() {
var $this = $(this)
, data = $this.data('popover')
, options = typeof option == 'object' && option
if (!data) $this.data('popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]() // <-- 3. this line has no semicolon no comma, why...?
})
}
.......................................
}(window.jQuery); // <-- 4. what does this line mean?
«2. В некоторых строках нет точки с запятой и запятой, почему?» - по умолчанию javascript добавляет точку с запятой к каждой новой строке. Для получения дополнительной информации: http://mislav.uniqpath.com/2010/05/semicolons/ –