Commit 675803d8 authored by Dries's avatar Dries

- Patch #1428534 by nod_: Use === and !==

parent 81c90b3c
......@@ -24,7 +24,7 @@ Drupal.behaviors.AJAX = {
// Load all Ajax behaviors specified in the settings.
for (var base in settings.ajax) {
var element_settings = settings.ajax[base];
if (typeof element_settings.selector == 'undefined') {
if (typeof element_settings.selector === 'undefined') {
element_settings.selector = '#' + base;
}
$(element_settings.selector).once('drupal-ajax', function() {
......@@ -151,14 +151,14 @@ Drupal.ajax = function (base, element, element_settings) {
success: function (response, status) {
// Sanity check for browser support (object expected).
// When using iFrame uploads, responses must be returned as a string.
if (typeof response == 'string') {
if (typeof response === 'string') {
response = $.parseJSON(response);
}
return ajax.success(response, status);
},
complete: function (response, status) {
ajax.ajaxing = false;
if (status == 'error' || status == 'parsererror') {
if (status === 'error' || status === 'parsererror') {
return ajax.error(response, ajax.url);
}
},
......@@ -206,7 +206,7 @@ Drupal.ajax.prototype.keypressResponse = function (element, event) {
// except for form elements of type 'text' and 'textarea', where the
// spacebar activation causes inappropriate activation if #ajax['keypress'] is
// TRUE. On a text-type widget a space should always be a space.
if (event.which == 13 || (event.which == 32 && element.type != 'text' && element.type != 'textarea')) {
if (event.which === 13 || (event.which === 32 && element.type !== 'text' && element.type !== 'textarea')) {
$(ajax.element_settings.element).trigger(ajax.element_settings.event);
return false;
}
......@@ -257,7 +257,7 @@ Drupal.ajax.prototype.eventResponse = function (element, event) {
// For radio/checkbox, allow the default event. On IE, this means letting
// it actually check the box.
if (typeof element.type != 'undefined' && (element.type == 'checkbox' || element.type == 'radio')) {
if (typeof element.type !== 'undefined' && (element.type === 'checkbox' || element.type === 'radio')) {
return true;
}
else {
......@@ -352,7 +352,7 @@ Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) {
$(this.element).addClass('progress-disabled').attr('disabled', true);
// Insert progressbar or throbber.
if (this.progress.type == 'bar') {
if (this.progress.type === 'bar') {
var progressBar = new Drupal.progressBar('ajax-progress-' + this.element.id, $.noop, this.progress.method, $.noop);
if (this.progress.message) {
progressBar.setProgress(-1, this.progress.message);
......@@ -364,7 +364,7 @@ Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) {
this.progress.object = progressBar;
$(this.element).after(this.progress.element);
}
else if (this.progress.type == 'throbber') {
else if (this.progress.type === 'throbber') {
this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber">&nbsp;</div></div>');
if (this.progress.message) {
this.progress.element.find('.throbber').after('<div class="message">' + this.progress.message + '</div>');
......@@ -418,12 +418,12 @@ Drupal.ajax.prototype.getEffect = function (response) {
var speed = response.speed || this.speed;
var effect = {};
if (type == 'none') {
if (type === 'none') {
effect.showEffect = 'show';
effect.hideEffect = 'hide';
effect.showSpeed = '';
}
else if (type == 'fade') {
else if (type === 'fade') {
effect.showEffect = 'fadeIn';
effect.hideEffect = 'fadeOut';
effect.showSpeed = speed;
......@@ -492,7 +492,7 @@ Drupal.ajax.prototype.commands = {
// content satisfies the requirement of a single top-level element, and
// only use the container DIV created above when it doesn't. For more
// information, please see http://drupal.org/node/736066.
if (new_content.length != 1 || new_content.get(0).nodeType != 1) {
if (new_content.length !== 1 || new_content.get(0).nodeType !== 1) {
new_content = new_content_wrapped;
}
......@@ -511,7 +511,7 @@ Drupal.ajax.prototype.commands = {
wrapper[method](new_content);
// Immediately hide the new content if we're using any effects.
if (effect.showEffect != 'show') {
if (effect.showEffect !== 'show') {
new_content.hide();
}
......@@ -522,7 +522,7 @@ Drupal.ajax.prototype.commands = {
new_content.show();
new_content.find('.ajax-new-content')[effect.showEffect](effect.showSpeed);
}
else if (effect.showEffect != 'show') {
else if (effect.showEffect !== 'show') {
new_content[effect.showEffect](effect.showSpeed);
}
......
......@@ -12,7 +12,7 @@ Drupal.behaviors.batch = {
// Success: redirect to the summary.
var updateCallback = function (progress, status, pb) {
if (progress == 100) {
if (progress === '100') {
pb.stopMonitoring();
window.location = settings.batch.uri + '&op=finished';
}
......
......@@ -60,8 +60,8 @@ Drupal.behaviors.collapse = {
$(context).find('fieldset.collapsible').once('collapse', function () {
var $fieldset = $(this);
// Expand fieldset if there are errors inside, or if it contains an
// element that is targeted by the uri fragment identifier.
var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : '';
// element that is targeted by the uri fragment identifier.
var anchor = location.hash && location.hash !== '#' ? ', ' + location.hash : '';
if ($fieldset.find('.error' + anchor).length) {
$fieldset.removeClass('collapsed');
}
......
......@@ -245,12 +245,12 @@ Drupal.formatPlural = function (count, singular, plural, args, options) {
args = args || {};
args['@count'] = count;
// Determine the index of the plural form.
var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] === 1) ? 0 : 1);
if (index == 0) {
if (index === 0) {
return Drupal.t(singular, args, options);
}
else if (index == 1) {
else if (index === 1) {
return Drupal.t(plural, args, options);
}
else {
......@@ -322,7 +322,7 @@ Drupal.encodePath = function (item) {
*/
Drupal.getSelection = function (element) {
var range1, range2, start, end;
if (typeof element.selectionStart != 'number' && document.selection) {
if (typeof element.selectionStart !== 'number' && document.selection) {
// The current selection.
range1 = document.selection.createRange();
range2 = range1.duplicate();
......@@ -352,7 +352,7 @@ Drupal.ajaxError = function (xmlhttp, uri) {
statusCode += "\n" + Drupal.t("Debugging information follows.");
pathText = "\n" + Drupal.t("Path: !uri", {'!uri': uri} );
statusText = '';
// In some cases, when statusCode == 0, xmlhttp.statusText may not be defined.
// In some cases, when statusCode === 0, xmlhttp.statusText may not be defined.
// Unfortunately, testing for it with typeof, etc, doesn't seem to catch that
// and the test causes an exception. So we need to catch the exception here.
try {
......@@ -372,7 +372,7 @@ Drupal.ajaxError = function (xmlhttp, uri) {
responseText = responseText.replace(/[\n]+\s+/g,"\n");
// We don't need readyState except for status == 0.
readyStateText = xmlhttp.status == 0 ? ("\n" + Drupal.t("ReadyState: !readyState", {'!readyState': xmlhttp.readyState})) : "";
readyStateText = xmlhttp.status === 0 ? ("\n" + Drupal.t("ReadyState: !readyState", {'!readyState': xmlhttp.readyState})) : "";
message = statusCode + pathText + statusText + responseText + readyStateText;
return message;
......
......@@ -22,7 +22,7 @@ $.fn.drupalSetSummary = function (callback) {
// To facilitate things, the callback should always be a function. If it's
// not, we wrap it into an anonymous function which just returns the value.
if (typeof callback != 'function') {
if (typeof callback !== 'function') {
var val = callback;
callback = function () { return val; };
}
......
......@@ -51,7 +51,7 @@ Drupal.behaviors.machineName = {
// Determine the initial machine name value. Unless the machine name form
// element is disabled or not empty, the initial default value is based on
// the human-readable form element value.
if ($target.is(':disabled') || $target.val() != '') {
if ($target.is(':disabled') || $target.val() !== '') {
var machine = $target.val();
}
else {
......@@ -84,12 +84,12 @@ Drupal.behaviors.machineName = {
// Preview the machine name in realtime when the human-readable name
// changes, but only if there is no machine name yet; i.e., only upon
// initial creation, not when editing.
if ($target.val() == '') {
if ($target.val() === '') {
$source.bind('keyup.machineName change.machineName', function () {
machine = self.transliterate($(this).val(), options);
// Set the machine name to the transliterated value.
if (machine != '') {
if (machine != options.replace) {
if (machine !== '') {
if (machine !== options.replace) {
$target.val(machine);
$preview.html(options.field_prefix + Drupal.checkPlain(machine) + options.field_suffix);
}
......
......@@ -77,7 +77,7 @@ Drupal.progressBar.prototype.sendPing = function () {
dataType: 'json',
success: function (progress) {
// Display errors.
if (progress.status == 0) {
if (progress.status === 0) {
pb.displayError(progress.data);
return;
}
......
......@@ -202,7 +202,7 @@ states.Dependent.prototype = {
// This constraint is an array (OR or XOR).
var hasXor = $.inArray('xor', constraints) === -1;
for (var i = 0, len = constraints.length; i < len; i++) {
if (constraints[i] != 'xor') {
if (constraints[i] !== 'xor') {
var constraint = this.checkConstraints(constraints[i], selector, i);
// Return if this is OR and we have a satisfied constraint or if this
// is XOR and we have a second satisfied constraint.
......@@ -320,7 +320,7 @@ states.Trigger.prototype = {
initialize: function () {
var trigger = states.Trigger.states[this.state];
if (typeof trigger == 'function') {
if (typeof trigger === 'function') {
// We have a custom trigger initialization function.
trigger.call(window, this.element);
}
......@@ -369,7 +369,7 @@ states.Trigger.states = {
'keyup': function () {
// The function associated to that trigger returns the new value for the
// state.
return this.val() == '';
return this.val() === '';
}
},
......@@ -428,7 +428,7 @@ states.State = function(state) {
// Normalize the state name.
while (true) {
// Iteratively remove exclamation marks and invert the value.
while (this.name.charAt(0) == '!') {
while (this.name.charAt(0) === '!') {
this.name = this.name.substring(1);
this.invert = !this.invert;
}
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ Drupal.behaviors.tableSelect = {
Drupal.tableSelect = function () {
// Do not add a "Select all" checkbox if there are no rows with checkboxes in the table
if ($(this).find('td input:checkbox').length == 0) {
if ($(this).find('td input:checkbox').length === 0) {
return;
}
......@@ -49,13 +49,13 @@ Drupal.tableSelect = function () {
// If this is a shift click, we need to highlight everything in the range.
// Also make sure that we are actually checking checkboxes over a range and
// that a checkbox has been checked or unchecked before.
if (e.shiftKey && lastChecked && lastChecked != e.target) {
if (e.shiftKey && lastChecked && lastChecked !== e.target) {
// We use the checkbox's parent TR to do our range searching.
Drupal.tableSelectRange($(e.target).closest('tr')[0], $(lastChecked).closest('tr')[0], e.target.checked);
}
// If all checkboxes are checked, make sure the select-all one is checked too, otherwise keep unchecked.
updateSelectAll((checkboxes.length == checkboxes.filter(':checked').length));
updateSelectAll((checkboxes.length === checkboxes.filter(':checked').length));
// Keep track of the last checked checkbox.
lastChecked = e.target;
......@@ -69,7 +69,7 @@ Drupal.tableSelectRange = function (from, to, state) {
// Traverse through the sibling nodes.
for (var i = from[mode], $i; i; i = i[mode]) {
// Make sure that we're only dealing with elements.
if (i.nodeType != 1) {
if (i.nodeType !== 1) {
continue;
}
$i = $(i);
......@@ -81,7 +81,7 @@ Drupal.tableSelectRange = function (from, to, state) {
if (to.nodeType) {
// If we are at the end of the range, stop.
if (i == to) {
if (i === to) {
break;
}
}
......
......@@ -31,12 +31,12 @@ Drupal.behaviors.setTimezone = {
var isDaylightSavingTime;
// If the offset from UTC is identical on January 1 and July 1,
// assume daylight saving time is not used in this time zone.
if (offsetJan == offsetJul) {
if (offsetJan === offsetJul) {
isDaylightSavingTime = '';
}
// If the maximum annual offset is equivalent to the current offset,
// assume daylight saving time is in effect.
else if (Math.max(offsetJan, offsetJul) == offsetNow) {
else if (Math.max(offsetJan, offsetJul) === offsetNow) {
isDaylightSavingTime = 1;
}
// Otherwise, assume daylight saving time is not in effect.
......
......@@ -22,7 +22,7 @@ Drupal.behaviors.verticalTabs = {
// Check if there are some fieldsets that can be converted to vertical-tabs
var $fieldsets = $this.find('> fieldset');
if ($fieldsets.length == 0) {
if ($fieldsets.length === 0) {
return;
}
......@@ -42,7 +42,7 @@ Drupal.behaviors.verticalTabs = {
.removeClass('collapsible collapsed')
.addClass('vertical-tabs-pane')
.data('verticalTab', vertical_tab);
if (this.id == focusID) {
if (this.id === focusID) {
tab_focus = $this;
}
});
......@@ -88,7 +88,7 @@ Drupal.verticalTab = function (settings) {
// Keyboard events added:
// Pressing the Enter key will open the tab pane.
this.link.keydown(function(event) {
if (event.keyCode == 13) {
if (event.keyCode === 13) {
self.focus();
// Set focus on the first input field of the visible fieldset/tab pane.
$("fieldset.vertical-tabs-pane :input:visible:enabled:first").focus();
......
......@@ -10,7 +10,7 @@ Drupal.behaviors.blockSettingsSummary = {
// The drupalSetSummary method required for this behavior is not available
// on the Blocks administration page, so we need to make sure this
// behavior is processed only if drupalSetSummary is defined.
if (typeof jQuery.fn.drupalSetSummary == 'undefined') {
if (typeof jQuery.fn.drupalSetSummary === 'undefined') {
return;
}
......@@ -42,7 +42,7 @@ Drupal.behaviors.blockSettingsSummary = {
$('#edit-user').drupalSetSummary(function (context) {
var $radio = $(context).find('input[name="custom"]:checked');
if ($radio.val() == 0) {
if ($radio.val() === 0) {
return Drupal.t('Not customizable');
}
else {
......@@ -61,7 +61,7 @@ Drupal.behaviors.blockSettingsSummary = {
Drupal.behaviors.blockDrag = {
attach: function (context, settings) {
// tableDrag is required and we should be on the blocks admin page.
if (typeof Drupal.tableDrag == 'undefined' || typeof Drupal.tableDrag.blocks == 'undefined') {
if (typeof Drupal.tableDrag === 'undefined' || typeof Drupal.tableDrag.blocks === 'undefined') {
return;
}
......@@ -88,7 +88,7 @@ Drupal.behaviors.blockDrag = {
var regionName = regionRow.className.replace(/([^ ]+[ ]+)*region-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
var regionField = $rowElement.find('select.block-region-select');
// Check whether the newly picked region is available for this block.
if (regionField.find('option[value=' + regionName + ']').length == 0) {
if (regionField.find('option[value=' + regionName + ']').length === 0) {
// If not, alert the user and keep the block in its old region setting.
alert(Drupal.t('The block cannot be placed in this region.'));
// Simulate that there was a selected element change, so the row is put
......@@ -129,14 +129,14 @@ Drupal.behaviors.blockDrag = {
table.find('tr.region-message').each(function () {
var $this = $(this);
// If the dragged row is in this region, but above the message row, swap it down one space.
if ($this.prev('tr').get(0) == rowObject.element) {
if ($this.prev('tr').get(0) === rowObject.element) {
// Prevent a recursion problem when using the keyboard to move rows up.
if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
if ((rowObject.method !== 'keyboard' || rowObject.direction === 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty.
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length == 0) {
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length === 0) {
$this.removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
......
......@@ -12,7 +12,7 @@ Drupal.behaviors.color = {
var i, j, colors, field_name;
// This behavior attaches by ID, so is only valid once on a page.
var form = $(context).find('#system-theme-settings .color-form').once('color');
if (form.length == 0) {
if (form.length === 0) {
return;
}
var inputs = [];
......@@ -45,7 +45,7 @@ Drupal.behaviors.color = {
// Add rows (or columns for horizontal gradients).
// Each gradient line should have a height (or width for horizontal
// gradients) of 10px (because we divided the height/width by 10 above).
for (j = 0; j < (settings.gradients[i]['direction'] == 'vertical' ? height[i] : width[i]); ++j) {
for (j = 0; j < (settings.gradients[i]['direction'] === 'vertical' ? height[i] : width[i]); ++j) {
gradient.append('<div class="gradient-line"></div>');
}
}
......@@ -53,7 +53,7 @@ Drupal.behaviors.color = {
// Set up colorScheme selector.
form.find('#edit-scheme').change(function () {
var schemes = settings.color.schemes, colorScheme = this.options[this.selectedIndex].value;
if (colorScheme != '' && schemes[colorScheme]) {
if (colorScheme !== '' && schemes[colorScheme]) {
// Get colors of active scheme.
colors = schemes[colorScheme];
for (field_name in colors) {
......@@ -76,8 +76,8 @@ Drupal.behaviors.color = {
* This algorithm ensures relative ordering on the saturation and luminance
* axes is preserved, and performs a simple hue shift.
*
* It is also symmetrical. If: shift_color(c, a, b) == d, then
* shift_color(d, b, a) == c.
* It is also symmetrical. If: shift_color(c, a, b) === d, then
* shift_color(d, b, a) === c.
*/
function shift_color(given, ref1, ref2) {
// Convert to HSL.
......@@ -87,7 +87,7 @@ Drupal.behaviors.color = {
given[0] += ref2[0] - ref1[0];
// Saturation: interpolate.
if (ref1[1] == 0 || ref2[1] == 0) {
if (ref1[1] === 0 || ref2[1] === 0) {
given[1] = ref2[1];
}
else {
......@@ -101,7 +101,7 @@ Drupal.behaviors.color = {
}
// Luminance: interpolate.
if (ref1[2] == 0 || ref2[2] == 0) {
if (ref1[2] === 0 || ref2[2] === 0) {
given[2] = ref2[2];
}
else {
......@@ -129,7 +129,7 @@ Drupal.behaviors.color = {
});
// Change input value.
if ($(input).val() && $(input).val() != color) {
if ($(input).val() && $(input).val() !== color) {
$(input).val(color);
// Update locked values.
......
......@@ -27,7 +27,7 @@ Drupal.behaviors.dashboard = {
var $this = $(this);
var empty_text = "";
// If the region is empty
if ($this.find('.block').length == 0) {
if ($this.find('.block').length === 0) {
// Check if we are in customize mode and grab the correct empty text
if ($('#dashboard').hasClass('customize-mode')) {
empty_text = Drupal.settings.dashboard.emptyRegionTextActive;
......@@ -35,7 +35,7 @@ Drupal.behaviors.dashboard = {
empty_text = Drupal.settings.dashboard.emptyRegionTextInactive;
}
// We need a placeholder.
if ($this.find('.placeholder').length == 0) {
if ($this.find('.placeholder').length === 0) {
$this.append('<div class="placeholder"></div>');
}
$this.find('.placeholder').html(empty_text);
......
......@@ -2,7 +2,7 @@
* @file
* Attaches the behaviors for the Field UI module.
*/
(function($) {
"use strict";
......@@ -54,11 +54,11 @@ Drupal.fieldUIFieldOverview = {
this.targetTextfield
.data('field_ui_edited', false)
.bind('keyup', function (e) {
$(this).data('field_ui_edited', $(this).val() != '');
$(this).data('field_ui_edited', $(this).val() !== '');
});
$this.bind('change keyup', function (e, updateText) {
var updateText = (typeof updateText == 'undefined' ? true : updateText);
var updateText = (typeof updateText === 'undefined' ? true : updateText);
var selectedField = this.options[this.selectedIndex].value;
var selectedFieldType = (selectedField in fields ? fields[selectedField].type : null);
var selectedFieldWidget = (selectedField in fields ? fields[selectedField].widget : null);
......@@ -85,7 +85,7 @@ Drupal.fieldUIFieldOverview = {
jQuery.fn.fieldUIPopulateOptions = function (options, selected) {
return this.each(function () {
var disabled = false;
if (options.length == 0) {
if (options.length === 0) {
options = [this.initialValue];
disabled = true;
}
......@@ -99,7 +99,7 @@ jQuery.fn.fieldUIPopulateOptions = function (options, selected) {
jQuery.each(options, function (value, text) {
// Figure out which value should be selected. The 'selected' param
// takes precedence.
var is_selected = ((typeof selected != 'undefined' && value == selected) || (typeof selected == 'undefined' && text == previousSelectedText));
var is_selected = ((typeof selected !== 'undefined' && value === selected) || (typeof selected === 'undefined' && text === previousSelectedText));
html += '<option value="' + value + '"' + (is_selected ? ' selected="selected"' : '') + '>' + text + '</option>';
});
......@@ -154,7 +154,7 @@ Drupal.fieldUIOverview = {
// Handle region change.
var region = rowHandler.getRegion();
if (region != rowHandler.region) {
if (region !== rowHandler.region) {
// Remove parenting.
$row.find('select.field-parent').val('');
// Let the row handler deal with the region change.
......@@ -175,11 +175,11 @@ Drupal.fieldUIOverview = {
var row = dragObject.rowObject.element;
var $row = $(row);
var rowHandler = $row.data('fieldUIRowHandler');
if (rowHandler !== undefined) {
if (typeof rowHandler === 'undefined') {
var regionRow = $row.prevAll('tr.region-message').get(0);
var region = regionRow.className.replace(/([^ ]+[ ]+)*region-([^ ]+)-message([ ]+[^ ]+)*/, '$2');
if (region != rowHandler.region) {
if (region !== rowHandler.region) {
// Let the row handler deal with the region change.
var refreshRows = rowHandler.regionChange(region);
// Update the row region.
......@@ -206,14 +206,14 @@ Drupal.fieldUIOverview = {
var $this = $(this);
// If the dragged row is in this region, but above the message row, swap
// it down one space.
if ($this.prev('tr').get(0) == rowObject.group[rowObject.group.length - 1]) {
if ($this.prev('tr').get(0) === rowObject.group[rowObject.group.length - 1]) {
// Prevent a recursion problem when using the keyboard to move rows up.
if ((rowObject.method != 'keyboard' || rowObject.direction == 'down')) {
if ((rowObject.method !== 'keyboard' || rowObject.direction === 'down')) {
rowObject.swap('after', this);
}
}
// This region has become empty.
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length == 0) {
if ($this.next('tr').is(':not(.draggable)') || $this.next('tr').length === 0) {
$this.removeClass('region-populated').addClass('region-empty');
}
// This region has become populated.
......@@ -300,7 +300,7 @@ Drupal.fieldUIDisplayOverview.field.prototype = {
* Returns the region corresponding to the current form values of the row.
*/
getRegion: function () {
return (this.$formatSelect.val() == 'hidden') ? 'hidden' : 'visible';
return (this.$formatSelect.val() === 'hidden') ? 'hidden' : 'visible';
},
/**
......@@ -327,10 +327,10 @@ Drupal.fieldUIDisplayOverview.field.prototype = {
var currentValue = this.$formatSelect.val();
switch (region) {
case 'visible':
if (currentValue == 'hidden') {
if (currentValue === 'hidden') {
// Restore the formatter back to the default formatter. Pseudo-fields do
// not have default formatters, we just return to 'visible' for those.
var value = (this.defaultFormatter != undefined) ? this.defaultFormatter : 'visible';
var value = (typeof this.defaultFormatter !== 'undefined') ? this.defaultFormatter : 'visible';
}
break;
......@@ -338,7 +338,7 @@ Drupal.fieldUIDisplayOverview.field.prototype = {
var value = 'hidden';
break;
}
if (value != undefined) {
if (typeof value !== 'undefined') {
this.$formatSelect.val(value);
}
......
......@@ -37,7 +37,7 @@ Drupal.menu_update_parent_list = function () {
// Add new options to dropdown.
jQuery.each(options, function(index, value) {
$('fieldset#edit-menu #edit-menu-parent').append(
$('<option ' + (index == selected ? ' selected="selected"' : '') + '></option>').val(index).text(value)
$('<option ' + (index === selected ? ' selected="selected"' : '') + '></option>').val(index).text(value)
);
});
}
......
......@@ -10,7 +10,7 @@ Drupal.behaviors.openid = {
var cookie = $.cookie('Drupal.visitor.openid_identifier');
// This behavior attaches by ID, so is only valid once on a page.
if (cookie || location.hash == '#openid-login') {
if (cookie || location.hash === '#openid-login') {
var $edit_openid_identifier = $('#edit-openid-identifier');
if (cookie) {
$edit_openid_identifier.val(cookie);
......
......@@ -33,7 +33,7 @@ Drupal.behaviors.overlayChild = {
// Use setTimeout to close the child window from a separate thread,
// because the current one is busy processing Drupal behaviors.
setTimeout(function () {
if (typeof settings.redirect == 'string') {
if (typeof settings.redirect === 'string') {
parent.Drupal.overlay.redirect(settings.redirect);
}
else {
......@@ -116,7 +116,7 @@ Drupal.overlayChild.behaviors.parseForms = function (context, settings) {
// Obtain the action attribute of the form.
var action = $(this).attr('action');
// Keep internal forms in the overlay.
if (action == undefined || (action.indexOf('http') != 0 && action.indexOf('https') != 0)) {
if (typeof action === 'undefined' || (action.indexOf('http') !== 0 && action.indexOf('https') !== 0)) {
action += (action.indexOf('?') > -1 ? '&' : '?') + 'render=overlay';
$(this).attr('action', action);
}
......
......@@ -229,7 +229,7 @@ Drupal.overlay.redirect = function (url) {
var link = $(url.link(url)).get(0);
// If the link is already open, force the hashchange event to simulate reload.
if (window.location.href == link.href) {
if (window.location.href === link.href) {
$(window).triggerHandler('hashchange.drupal-overlay');
}
......@@ -266,7 +266,7 @@ Drupal.overlay.loadChild = function (event) {
var iframe = event.data.self;
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
var iframeWindow = iframeDocument.defaultView || iframeDocument.parentWindow;
if (iframeWindow.location == 'about:blank') {
if (iframeWindow.location === 'about:blank') {
return;
}
......@@ -401,7 +401,7 @@ Drupal.overlay.eventhandlerOuterResize = function (event) {
}
// IE6 uses position:absolute instead of position:fixed.
if (typeof document.body.style.maxHeight != 'string') {
if (typeof document.body.style.maxHeight !== 'string') {
this.activeFrame.height($(window).height());
}
......@@ -531,7 +531,7 @@ Drupal.overlay.eventhandlerRestoreDisplacedElements = function (event) {
Drupal.overlay.eventhandlerOverrideLink = function (event) {
// In some browsers the click event isn't fired for right-clicks. Use the
// mouseup event for right-clicks and the click event for everything else.
if ((event.type == 'click' && event.button == 2) || (event.type == 'mouseup' && event.button != 2)) {
if ((event.type === 'click' && event.button === 2) || (event.type === 'mouseup' && event.button !== 2)) {
return;
}
......@@ -563,21 +563,21 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
if (typeof href !== 'undefined' && href !== '' && (/^https?\:/).test(target.protocol)) {
var anchor = href.replace(target.ownerDocument.location.href, '');
// Skip anchor links.
if (anchor.length == 0 || anchor.charAt(0) == '#') {
if (anchor.length === 0 || anchor.charAt(0) === '#') {
return;
}
// Open admin links in the overlay.
else if (this.isAdminLink(href)) {
// If the link contains the overlay-restore class and the overlay-context
// state is set, also update the parent window's location.
var parentLocation = ($target.hasClass('overlay-restore') && typeof $.bbq.getState('overlay-context') == 'string')
var parentLocation = ($target.hasClass('overlay-restore') && typeof $.bbq.getState('overlay-context') === 'string')
? Drupal.url($.bbq.getState('overlay-context'))
: null;
href = this.fragmentizeLink($target.get(0), parentLocation);
// Only override default behavior when left-clicking and user is not
// pressing the ALT, CTRL, META (Command key on the Macintosh keyboard)
// or SHIFT key.
if (event.button == 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
if (event.button === 0 && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
// Redirect to a fragmentized href. This will trigger a hashchange event.
this.redirect(href);
// Prevent default action and further propagation of the event.
......@@ -598,7 +598,7 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
else if (this.isOpen && target.ownerDocument === this.iframeWindow.document) {
// Open external links in the immediate parent of the frame, unless the
// link already has a different target.
if (target.hostname != window.location.hostname) {
if (target.hostname !== window.location.hostname) {
if (!$target.attr('target')) {
$target.attr('target', '_parent');
}
......@@ -690,7 +690,7 @@ Drupal.overlay.eventhandlerSyncURLFragment = function (event) {
if (this.isOpen) {
var expected = $.bbq.getState('overlay');
// This is just a sanity check, so we're comparing paths, not query strings.
if (this.getPath(Drupal.url(expected)) != this.getPath(this.iframeWindow.document.location)) {
if (this.getPath(Drupal.url(expected)) !== this.getPath(this.iframeWindow.document.location)) {
// There may have been a redirect inside the child overlay window that the
// parent wasn't aware of. Update the parent URL fr