Bug 606824 - Replace "typeof ... == undefined" checks; r=ian a=beltzner

This commit is contained in:
Martin Cerdeira 2011-01-17 12:31:39 -05:00
parent 46c6093f7a
commit 0ce21ab28f
4 changed files with 15 additions and 27 deletions

View File

@ -66,7 +66,7 @@
// dontPush - true if this groupItem shouldn't push away or snap on creation; default is false
// immediately - true if we want all placement immediately, not with animation
function GroupItem(listOfEls, options) {
if (typeof options == 'undefined')
if (!options)
options = {};
this._inited = false;
@ -813,7 +813,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
item.removeTrenches();
if (typeof options == 'undefined')
if (!options)
options = {};
var self = this;
@ -897,7 +897,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
item = Items.item($el);
}
if (typeof options == 'undefined')
if (!options)
options = {};
var index = this._children.indexOf(item);
@ -1122,21 +1122,15 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// Possible "options" properties:
// animate - whether to animate; default: true.
_stackArrange: function GroupItem__stackArrange(childrenToArrange, bb, options) {
var animate;
if (!options || typeof options.animate == 'undefined')
animate = true;
else
animate = options.animate;
if (typeof options == 'undefined')
if (!options)
options = {};
var animate = "animate" in options ? options.animate : true;
var count = childrenToArrange.length;
if (!count)
return;
var zIndex = this.getZ() + count + 1;
var maxRotation = 35; // degress
var scale = 0.8;
var newTabsPad = 10;

View File

@ -166,7 +166,7 @@ function iQClass(selector, context) {
return null;
}
if (typeof selector.selector !== "undefined") {
if ("selector" in selector) {
this.selector = selector.selector;
this.context = selector.context;
}
@ -360,7 +360,7 @@ iQClass.prototype = {
// pass in just key to retrieve it.
data: function iQClass_data(key, value) {
let data = null;
if (typeof value === "undefined") {
if (value === undefined) {
Utils.assert(this.length == 1, 'does not yet support multi-objects (or null objects)');
data = this[0].iQData;
if (data)
@ -388,7 +388,7 @@ iQClass.prototype = {
// what's already there.
html: function iQClass_html(value) {
Utils.assert(this.length == 1, 'does not yet support multi-objects (or null objects)');
if (typeof value === "undefined")
if (value === undefined)
return this[0].innerHTML;
this[0].innerHTML = value;
@ -401,7 +401,7 @@ iQClass.prototype = {
// what's already there.
text: function iQClass_text(value) {
Utils.assert(this.length == 1, 'does not yet support multi-objects (or null objects)');
if (typeof value === "undefined") {
if (value === undefined) {
return this[0].textContent;
}
@ -413,7 +413,7 @@ iQClass.prototype = {
// Given a value, sets the receiver's value to it; otherwise returns what's already there.
val: function iQClass_val(value) {
Utils.assert(this.length == 1, 'does not yet support multi-objects (or null objects)');
if (typeof value === "undefined") {
if (value === undefined) {
return this[0].value;
}
@ -446,7 +446,7 @@ iQClass.prototype = {
// Sets or gets an attribute on the element(s).
attr: function iQClass_attr(key, value) {
Utils.assert(typeof key === 'string', 'string key');
if (typeof value === "undefined") {
if (value === undefined) {
Utils.assert(this.length == 1, 'retrieval does not support multi-objects (or null objects)');
return this[0].getAttribute(key);
}
@ -471,7 +471,7 @@ iQClass.prototype = {
if (typeof a === 'string') {
let key = a;
if (typeof b === "undefined") {
if (b === undefined) {
Utils.assert(this.length == 1, 'retrieval does not support multi-objects (or null objects)');
return window.getComputedStyle(this[0], null).getPropertyValue(key);
@ -596,7 +596,7 @@ iQClass.prototype = {
// Function: fadeOut
// Animates the receiver to full transparency. Calls callback on completion.
fadeOut: function iQClass_fadeOut(callback) {
Utils.assert(typeof callback == "function" || typeof callback === "undefined",
Utils.assert(typeof callback == "function" || callback === undefined,
'does not yet support duration');
this.animate({

View File

@ -939,12 +939,9 @@ let Items = {
// width value of the child items (`childWidth`) and the number of columns
// (`columns`) is returned.
arrange: function Items_arrange(items, bounds, options) {
if (typeof options == 'undefined')
if (!options)
options = {};
var animate = true;
if (typeof options.animate != 'undefined')
animate = options.animate;
var animate = "animate" in options ? options.animate : true;
var immediately = !animate;
var rects = [];

View File

@ -1184,9 +1184,6 @@ let UI = {
// Parameters:
// force - true to update even when "unnecessary"; default false
_resize: function UI__resize(force) {
if (typeof force == "undefined")
force = false;
if (!this._pageBounds)
return;