Author: jablko
Date: Thu Oct 21 21:34:33 2010
New Revision: 8361
Log:
Check strict equality, except null
Modified:
trunk/js/dialog.js
Modified: trunk/js/dialog.js
==============================================================================
--- trunk/js/dialog.js Thu Oct 21 21:30:35 2010 (r8360)
+++ trunk/js/dialog.js Thu Oct 21 21:34:33 2010 (r8361)
@@ -34,7 +34,7 @@
// Build an internal representation of HTML table elements
$(':input', thisDialog.table).each(function ()
{
- if ('' == this.name || undefined != thisDialog.fields[this.name])
+ if ('' === this.name || undefined !== thisDialog.fields[this.name])
{
return;
}
@@ -167,7 +167,7 @@
}
// If no iframes, just submit
- if (0 == thisDialog.count)
+ if (0 === thisDialog.count)
{
thisDialog.done();
}
@@ -201,16 +201,16 @@
// Autocomplete text
return $(this.fields[fname]).next().val();
}
- else if ('select-one' == this.fields[fname].type || 'select-multi'
== this.fields[fname].type)
+ else if ('select-one' === this.fields[fname].type ||
'select-multi' === this.fields[fname].type)
{
// Select box text
return $(this.fields[fname]).children(':selected').text();
}
- else if ('radio' == this.fields[fname].type)
+ else if ('radio' === this.fields[fname].type)
{
return $('input[name=' + fname + ']:checked',
thisDialog.table).val();
}
- else if (undefined != this.fields[fname].value)
+ else if (undefined !== this.fields[fname].value)
{
return this.fields[fname].value;
}
@@ -237,7 +237,7 @@
this.open = function (id)
{
this.id = id;
- if (undefined == this.id)
+ if (undefined === this.id)
{
// If no "id" passed as argument then create unique id and skip
// the data load
@@ -257,7 +257,7 @@
this.loadData = function (id, callback)
{
- if (undefined != this.data[id])
+ if (undefined !== this.data[id])
{
this.updateDialog(id, this.data[id], callback)
}
@@ -268,7 +268,7 @@
dataSource.responseType = YAHOO.util.DataSourceBase.TYPE_JSON;
dataSource.parseJSONData = function (request, response)
{
- if (undefined != thisDialog.options.relationTableMap)
+ if (undefined !== thisDialog.options.relationTableMap)
{
return { results:
[thisDialog.options.relationTableMap(response)] };
}
@@ -296,7 +296,7 @@
this.updateDialog = function (thisId, thisData, callback)
{
- if (undefined == this.data[thisId])
+ if (undefined === this.data[thisId])
{
this.data[thisId] = thisData;
}
@@ -319,7 +319,7 @@
// First check if a "Display" value is include in "thisData"
var displayField = fieldname.substr(0, fieldname.length - 1) +
'Display]';
- if (undefined != thisData[displayField])
+ if (undefined !== thisData[displayField])
{
$(hiddenInput).next('input').val(jQuery.trim(thisData[displayField]));
}
@@ -345,7 +345,7 @@
}
}
- if (undefined != callback)
+ if (undefined !== callback)
{
callback();
}
@@ -360,7 +360,7 @@
// Test for existing <iframe/>
for (var i in thisDialog.iframes)
{
- if (thisDialog.id == thisDialog.iframes[i].dialogId &&
$hidden.attr('name') == thisDialog.iframes[i].inputName)
+ if (thisDialog.id === thisDialog.iframes[i].dialogId &&
$hidden.attr('name') === thisDialog.iframes[i].inputName)
{
var index = i;
}
@@ -370,7 +370,7 @@
if (0 < this.value.length)
{
// If no URI is set, then selecting unmatched value
- if (0 == $hidden.val().length)
+ if (0 === $hidden.val().length)
{
// Allowing adding new values via iframe
var value = $('~ .add', this).val();
@@ -378,7 +378,7 @@
{
var components = value.split(' ', 2);
- if (undefined == index)
+ if (undefined === index)
{
// Add hidden <iframe/> for each new choice
$iframe = $('<iframe src="' + components[0] + '"/>')
@@ -403,7 +403,7 @@
}
// Remove <iframe/> if selecting a pre-existing value
- else if (undefined != index && this.value !=
thisDialog.iframes[index].iframe.value)
+ else if (undefined !== index && this.value !==
thisDialog.iframes[index].iframe.value)
{
delete thisDialog.iframes[index];
}
@@ -427,14 +427,14 @@
if (0 < this.fields[fname].length)
{
var initVal = this.initialValues[fname];
- if ('string' == typeof initVal)
+ if ('string' === typeof initVal)
{
initVal = [initVal]; // Cast as array
}
$(this.fields[fname]).val(initVal);
}
- else if ('select-one' == this.fields[fname].type)
+ else if ('select-one' === this.fields[fname].type)
{
// Select first option in single option select controls
this.fields[fname].options[0].selected = true;
@@ -453,7 +453,7 @@
this.remove = function (thisId)
{
- if (undefined == this.data[thisId])
+ if (undefined === this.data[thisId])
{
return;
}
@@ -469,7 +469,7 @@
});
// If this is an existing relationship, then store id for deletion
- if ('new' != thisId.substr(0, 3))
+ if ('new' !== thisId.substr(0, 3))
{
this.deletes.push(thisId.match(/\d+$/));
}
@@ -483,13 +483,13 @@
var displayTable =
document.getElementById(this.options.displayTable);
var newRowTemplate = this.options.newRowTemplate;
- if (undefined == displayTable || undefined == newRowTemplate)
+ if (undefined === displayTable || undefined === newRowTemplate)
{
return;
}
// Check for special field render handler
- if (undefined != this.options.handleFieldRender)
+ if (undefined !== this.options.handleFieldRender)
{
var render = function (fname)
{
@@ -563,7 +563,7 @@
var thisData = this.data[id];
// Don't include "id" if it's a "new" object
- if (null != id && 'new' != id.substr(0,3))
+ if (null != id && 'new' !== id.substr(0,3))
{
var name = outputPrefix + '[' + i + '][id]';
$(this.form).append('<input type="hidden" name="' + name + '"
value="' + id + '"/>');
@@ -589,7 +589,7 @@
// Update this value from iframe
for (var k in this.iframes)
{
- if (id == this.iframes[k].dialogId && j ==
this.iframes[k].inputName)
+ if (id === this.iframes[k].dialogId && j ===
this.iframes[k].inputName)
{
this.iframes[k].iframe.one('load', { 'hdn': $hidden },
function (e)
{
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.