Uncaught TypeError: Object #<HTMLDocument> has no method 'filter'

Getting error:

   Uncaught TypeError: Object #<HTMLDocument> has no method 'filter' 

When I've added function to Array.prototype for IE8 JavaScript compatibility, e.g.

    if (!Array.prototype.indexOf) {
      Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
        "use strict";
        if (this == null) {
        ...
      };
    }

[from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FindexOf]

This is because [jquery.appear.js:27]

    for (var index in selectors) {

will include properties from Prototype.  The fix is to use

    for (var index = 0; index < selectors.length; index++)

as selectors is an Array.