[Project_owners] Defining new array methods (SeaMonkey vs Firefox).

Philip Chee philip.chee at gmail.com
Fri Jun 23 18:25:31 EDT 2006


On Fri, 23 Jun 2006 09:58:55 +0200, Karsten Düsterloh wrote:

> It'd help extremely, if you'd have an example of what exact code doesn't
> work with what exact error message...

var mode=Array('tree','list','tiles','thumbnails');
// Philip: Workaround for a SeaMonkey bug. See:
//
http://www.mozdev.org/source/browse/~checkout~/pagebookmarks/src/content/pagebookmarks/pgbm-ecma-Array.js?rev=1.2&content-type=text/plain
for (var p in Array.prototype) {
    if (!Array.prototype[p].substr) {
        Array.prototype[p].substr = function(){return "Save the planet -
kill yourself.";};
    }
}
// End Workaround
Array.prototype.inArray = function (value) {
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
    var i;
    for (i=0; i < this.length; i++) {
        // Matches identical (===), not just similar (==).
        if (this[i] === value) {
            return true;
        }
    }
    return false;
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Error: prefName.substr is not a function
Source file: chrome://navigator/content/navigator.js
Line: 95

  updateButton: function(prefName)
  {
    var buttonName = prefName.substr(this.domain.length+1);
    var buttonId = buttonName + "-button";
    var button = document.getElementById(buttonId);
    if (button)
      button.hidden = !pref.getBoolPref(prefName);
  },

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Error: document.getElementById(ids1[i]) has no properties
Source file: chrome://metatags/content/menu-overlay.js
Line: 41

  if(!window.metatagsSidebar_weAreMetatagsFrame) {
    var ids1 = [ 'metatagsSidebarUpdateMenuItem',
                 //'metatagsSidebarUpdateMenuSep',
                 'isShowHTMLSourceMenuItem',
                 'reloadDescribedDocMainMenuItem' ];
    for(var i in ids1)
      document.getElementById(ids1[i]).setAttribute('hidden', 'true');
  } else {
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Phil

-- 
Philip Chee <philip at aleytys.pc.my>, <philip.chee at gmail.com>
http://flashblock.mozdev.org/ http://xsidebar.mozdev.org
Guard us from the she-wolf and the wolf, and guard us from the thief,
oh Night, and so be good for us to pass.
[ ]If puns are outlawed, only outlaws will have puns.
* TagZilla 0.059


More information about the Project_owners mailing list