Index: htmlarea.js
===================================================================
--- htmlarea.js	(revision 471)
+++ htmlarea.js	(working copy)
@@ -2532,31 +2532,36 @@
   this.updateToolbar();
 };
 
-if(!Array.prototype.contains)
+if (!Array.prototype.contains)
 {
   Array.prototype.contains = function(needle)
   {
-   var haystack = this;
-   for(var i = 0; i < haystack.length; i++)
-    {
-      if(needle == haystack[i]) return true;
-    }
-
-    return false;
+    return this.indexOf(needle) != -1;
   };
 }
 
-if(!Array.prototype.indexOf)
+if (!Array.prototype.indexOf)
 {
-  Array.prototype.indexOf = function(needle)
+  Array.prototype.indexOf = function(needle, fromIndex)
   {
-    var haystack = this;
-    for(var i = 0; i < haystack.length; i++)
+    if (!fromIndex)
     {
-      if(needle == haystack[i]) return i;
+      fromIndex = 0;
     }
+    else if (fromIndex < 0)
+    {
+      fromIndex = Math.max(0, this.length + fromIndex);
+    }
 
-    return null;
+    for (var i=fromIndex, ilen=this.length; i<ilen; i++)
+    {
+      if (this[i] === needle)
+      {
+        return i;
+      }
+    }
+
+    return -1;
   };
 }
 
