mozbrick / brick

UI Web Components for Modern Web Apps
http://mozbrick.github.io/
Other
2.97k stars 206 forks source link

Compatibility to Prototype.js #80

Closed ezzemm closed 10 years ago

ezzemm commented 10 years ago

1 2

Hi!

I want to use Brick on websites which uses Prototype.js. But unfortunatley it seems, they are incompatible.

Prototype.js throws a error: "TypeError: this.each is not a function", and the Tooltipps from Brick doesn't appear

pennyfx commented 10 years ago

Can you post your code?

ezzemm commented 10 years ago

Hi!

I am creating a Plugin, which can anybody install on his CMS, and let appear some stuff. Therefor, my code is quite short:

...some html...

<script src="PATH/scripts/vendor/modernizr-2.6.2.min.js"></script>
<script src="PATH/scripts/vendor/jquery-1.10.2.js"></script>
<script src="PATH/scripts/vendor/brick-1.0beta8.min.js"></script>

<table>
  <tr>
    <th>
      <span>Name</span>
      <x-tooltip trigger-style="hover">The content of the tooltip</x-tooltip>
    </th>
...

Thats all code belonging to Brick. I've tested my plugin with various CMS, and in all of those who are using Prototype, none of the Tooltipps work. But my jQuery stuff works.

For example, I've tested e107 in version 1.01. By default, e107 uses Prototype 1.7.0.0 and Scriptaculous 1.9.0 Immediately after loading my Plugin in e107, Firebug outputs this error:

prototype.js (Zeile 883)
TypeError: this.each is not a function
this.each(function(value, index) {

My jQuery stuff works, but not the Tooltip. Another CMS I've tried is MyBB 1.6.5. It uses Prototype 1.7 too, and Firebug gaves me the same error.

This is the code of Prototype, which Firebug throws out. I don't know what this function does, but it seems that it indexes the DOM and has a problem with x-tooltip-element In this case, it is a problem of Prototype, but not of brick.

function findAll(iterator, context) {
  var results = [];
  this.each(function(value, index) {
    if (iterator.call(context, value, index))
      results.push(value);
  });
  return results;
} 

To prove my theory, I've deleted this from my code, but not the x-tooltip-elements:

<script src="PATH/scripts/vendor/brick-1.0beta8.min.js"></script>

I've got no errors of Prototype. Then I've loaded Brick, but had no x-tooltip inside my code. And I've got the error again. So I think Brick causes the error.

pennyfx commented 10 years ago

Did you figure out the issue? If not can you console out this in that function?

csuwildcat commented 10 years ago

We do not modify prototypes, so if each is failing I don't believe it is possible that it is being caused by X-Tag (the library brick is based on). Can you provide a reduced test case that just includes X-Tag and Prototype together?

potch commented 10 years ago

Closing this up, I'm not sure what the issue is.