==
and !=
JS-00505166 return elementWidth + 'px';
5167 }
5168
5169 if (method == 'style') {5170 var style = $element.attr('style');
5171
5172 if (typeof(style) !== 'string') {
5156 return this._resolveWidth($element, 'element');
5157 }
5158
5159 if (method == 'element') {5160 var elementWidth = $element.outerWidth(false);
5161
5162 if (elementWidth <= 0) {
5146 Select2.prototype._resolveWidth = function ($element, method) {
5147 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5148
5149 if (method == 'resolve') {5150 var styleWidth = this._resolveWidth($element, 'style');
5151
5152 if (styleWidth != null) {
4990
4991 // Prefer the element's `dataset` attribute if it exists
4992 // jQuery 1.x does not correctly handle data attributes with multiple dashes
4993 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {4994 dataset = $.extend(true, {}, $e[0].dataset, $e.data());
4995 } else {
4996 dataset = $e.data();
4491 maximumSelected: function (args) {
4492 var message = 'You can only select ' + args.maximum + ' item';
4493
4494 if (args.maximum != 1) {4495 message += 's';
4496 }
4497
It is considered good practice to use the type-safe equality operators ===
and !==
instead of their regular counterparts ==
and !=
.
The strict equality operators (===
and !==
) use the strict equality comparison algorithm to compare two operands.
false
.true
only if they refer to the same object.null
or both operands are undefined
, return true
.NaN
, return false
.+0
and -0
are considered to be the same value.true
or both false
.The most notable difference between this operator and the equality (==
) operator is that if the operands are of different types, the ==
operator attempts to convert them to the same type before comparing.
a == b
foo == true
bananas != 1
value == undefined
typeof foo == 'undefined'
'hello' != 'world'
0 == 0
true == true
foo == null
a === b
foo === true
bananas !== 1
value === undefined
typeof foo === 'undefined'
'hello' !== 'world'
0 === 0
true === true
foo === null