When I run the following javascript in IE, I get "Error: Object doesn't support this property or method" on "data.every(...)".
It works in Chrome/Firefox.
When I run the following javascript in IE, I get "Error: Object doesn't support this property or method" on "data.every(...)".
It works in Chrome/Firefox.
There's no every
method defined in jQuery. You could use each instead:
$.each(data, function(index, task) {
createCardFromTask(task);
});
or a little shorter:
$.each(data, function() {
createCardFromTask(this);
});
.every()
is a JavaScript 1.6 enhancement to the Array prototype. Firefox supports this method in Gecko 1.8b2 and later, and here is a quick replacement if it doesn't exist.
From MDC:
every
is a recent addition to the ECMA-262 standard; as such it may not be present in all browsers. You can work around this by inserting the following code at the beginning of your scripts, allowing use of every in implementations which do not natively support it. This algorithm is exactly the one used in Firefox and SpiderMonkey.
if (!Array.prototype.every)
{
Array.prototype.every = function(fun /*, thisp*/)
{
var len = this.length >>> 0;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this &&
!fun.call(thisp, this[i], i, this))
return false;
}
return true;
};
}
I recently had the same problem with .each function when I tried to loop through selection of DOM elements. Turns out the problem wasn't with Javascript. It was the HTML, a special tag we were using. ABBR, isn't supported by IE6.
I suggest you first check all your tags, make sure all tags are supported by IE6.