Changeset 4477 in subversion


Ignore:
Timestamp:
Feb 1, 2011 4:08:17 AM (2 years ago)
Author:
alec
Message:
  • Unify typeof and undefined usage
Location:
trunk/roundcubemail/program/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/js/common.js

    r4411 r4477  
    168168{ 
    169169  e = e || window.event; 
    170   return e && (typeof e.button != 'undefined') ? e.button : (e && e.which ? e.which : 0); 
     170  return e && e.button !== undefined ? e.button : (e && e.which ? e.which : 0); 
    171171}, 
    172172 
     
    319319removeEventListener: function(evt, func, obj) 
    320320{ 
    321   if (typeof obj == 'undefined') 
     321  if (obj === undefined) 
    322322    obj = window; 
    323323 
     
    336336{ 
    337337  var ret, h; 
    338   if (typeof e == 'undefined') 
     338  if (e === undefined) 
    339339    e = this; 
    340   else if (typeof e == 'object') 
     340  else if (typeof e === 'object') 
    341341    e.event = evt; 
    342342 
     
    345345    for (var i=0; i < this._events[evt].length; i++) { 
    346346      if ((h = this._events[evt][i])) { 
    347         if (typeof h.func == 'function') 
     347        if (typeof h.func === 'function') 
    348348          ret = h.func.call ? h.func.call(h.obj, e) : h.func(e); 
    349         else if (typeof h.obj[h.func] == 'function') 
     349        else if (typeof h.obj[h.func] === 'function') 
    350350          ret = h.obj[h.func](e); 
    351351 
    352352        // cancel event execution 
    353         if (typeof ret != 'undefined' && !ret) 
     353        if (ret !== undefined && !ret) 
    354354          break; 
    355355      } 
     
    514514 
    515515  for (var key in obj) { 
    516     if (obj[key] && typeof obj[key] == 'object') 
     516    if (obj[key] && typeof obj[key] === 'object') 
    517517      out[key] = clone_object(obj[key]); 
    518518    else 
  • trunk/roundcubemail/program/js/googiespell.js

    r4149 r4477  
    9292 
    9393this.decorateTextarea = function(id) { 
    94     this.text_area = typeof(id) == 'string' ? document.getElementById(id) : id; 
     94    this.text_area = typeof id === 'string' ? document.getElementById(id) : id; 
    9595 
    9696    if (this.text_area) { 
     
    121121///// 
    122122this.setSpellContainer = function(id) { 
    123     this.spell_container = typeof(id) == 'string' ? document.getElementById(id) : id; 
     123    this.spell_container = typeof id === 'string' ? document.getElementById(id) : id; 
    124124}; 
    125125 
     
    932932///// 
    933933this.isDefined = function(o) { 
    934     return (o != 'undefined' && o != null) 
     934    return (o !== undefined && o !== null) 
    935935}; 
    936936 
  • trunk/roundcubemail/program/js/list.js

    r4411 r4477  
    5959 
    6060  // overwrite default paramaters 
    61   if (p && typeof(p) == 'object') 
     61  if (p && typeof p === 'object') 
    6262    for (var n in p) 
    6363      this[n] = p[n]; 
Note: See TracChangeset for help on using the changeset viewer.