Thanks, @anba.
The original webcompat thread points to a very similar issue with contains and MooTools, which strongly implies that this is not about the difference in behavior of the method itself (though I am pretty confident the difference in behavior would also cause breakage).
The specific problem with contains
, and I strongly suspect here, is as follows:
- MooTools is unconditionally setting up Array.prototype.{flatten, contains, etc} by regular property assignment, which creates an enumerable property if one does not exist but does not cause non-enumerable properties to become enumerable
- It latter copies all enumerable methods on Array.prototype to Elements.prototype (which is a MooTools specific extension used as e.g. the return type of their global
$$
helper). - As such, if we spec a non-enumerable method on Array.prototype which shares a name with something MooTools added, then MooTools will fail to copy that over to Elements.prototype. Sites depending on it being present will break.
That's unfortunate.