I have this jQuery in a Magento install:
jQuery(document).ready(function($) {
"use strict";
var firstItems = $('.item.first');
// Find tallest .item per row; match rest of row to it
firstItems.each(function($) {
var $first, row, headings, heights, maxHeight;
$first = $(this);
row = $first.add($first.nextUntil(firstItems));
headings = row.find("h2, h5");
heights = headings.map(function($) {
return $(this).outerHeight();
});
maxHeight = Math.max.apply(null, heights);
headings.css("height", maxHeight);
});
});
Sadly, it’s conflicting with Prototype. It is throwing the error:
[object object] is not a valid argument for 'Function.prototype.apply'
This leads me to believe that the conflict is coming from line 15:
maxHeight = Math.max.apply(null, heights);
Is there any way that I can wrap that function differently so that it’s ignored by prototype?
You are
.applyinga jQuery object, where as it should be an array.Prototype the library doesn’t add
Function.prototype.apply, it’s a native method.