To participate you must create an account on apostrophenow.com. If you have already done so, click Login.

Ticket #498 (closed defect: fixed)

Opened 7 weeks ago

Last modified 7 weeks ago

aControls - multipleSelect has a bug using indexOf method on an array in IE

Reported by: johnnyoffline Owned by: johnnyoffline
Priority: major Milestone: 1.4.1
Component: apostropheBlogPlugin Version: 1.4
Keywords: Toolkit, Categories, Multipleselect Cc: jake, boutell, rickybanister, dordille
Symfony version: 1.4

Description

This is confirmed in IE7 and IE8.

The bug occurs when trying to use the [+ New Category] feature in the blog plugin.

"JScript does not implement Array.prototype.indexOf, which is a non-standard Mozilla extension. String.prototype.indexOf still exists."

Documentation here
http://www.dynamicdrive.com/forums/showthread.php?t=36071
and here
https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference:Objects:Array:indexOf#Compatibility

error

Attachments

js-error.PNG (66.7 kB) - added by anonymous 7 weeks ago.

Change History

Changed 7 weeks ago by anonymous

Changed 7 weeks ago by johnnyoffline

  • status changed from new to closed
  • resolution set to fixed

The solution is place this before the code that tries to use indexOf.

However, this could probably be streamlined / optimized.

if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length >>> 0;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}

Changed 7 weeks ago by johnnyoffline

Trunk [1820]
1.4 Branch [1821]

Note: See TracTickets for help on using tickets.