我对 jquery 插件 - bootstrap-popover.js 有一些疑问。
- !function ($){ // 什么意思?
- 有些行没有分号和逗号,为什么?
- }(窗口.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?