Conflict with Prototype JavaScript framework, version 1.4.0
 
 
Post new topic   Reply to topic   printer-friendly view    phpMiX.org Forum Index -> phpBB MODs -> Select Expand BBCodes
View previous topic :: View next topic  
Author Message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Sat Feb 18, 2006 9:40 pm    Post subject: Conflict with Prototype JavaScript framework, version 1.4.0 Reply with quote

Hello,

i found that the prototype.js interferes with your mod.
this js is e.g. used in the searchbox mod here
http://www.phpbb.com/phpBB/viewtopic.php?t=362452

and it seems that this prototype.js will be used in the future for other mods,
ajax extensions etc.

Problem is that IE (FF and Opera are fine) doesnt display <expand>.
<select> is always displayed.

you discussed a similiar problem in the http://forums.phpmix.org/viewtopic.php?t=689 thread

and the prototype.js uses similiar functions as the fade.js

So i fear there is no solution for this?

Greetings.
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Sat Feb 18, 2006 11:23 pm    Post subject: Re: Conflict with Prototype JavaScript framework, version 1. Reply with quote

Last time I checked, there was a javascript error (Object does not support this property or method) in line 204, the code highlighted in blue here:
Code:
function SXBB_evalSize(cmd)
{
   for( var id in SXBB ) SXBB[id].resize(cmd);
}

SXBB is an associative array. The technique and the loop are perfectly correct, but it seems that it is broken (IE) when the native Array object is extended, which is what fade.js and prototype.js actually do.

IMHO, as I said in that thread, this technique, while being correct too, may break other javascripts, when different snippets (probably written by different authors) are running on the same environment. Well, the main reason is that there might be different javascripts trying to extend native objects in different ways. That's why I consider that technique obtrusive.

So, what to do? Who should move next?

The code related to SXBB would have to be rewritten to not use associative arrays, and then maybe we would find another conflict. ...or they could rewrite their code ...or the browser bug could not exist, heh.

Maybe IE7 comes with this bug fixed, but it is still in beta and it will only work in XP. There will be IE6 for years.

If the problem was caused by my code, I would gladly provide a fix. But in this case, the browser bug is generated as a consequence of a javascript programming technique they use, that is, this unfortunate browser bug aside, prone to conflicts with other javascripts.

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Sun Feb 19, 2006 8:12 am    Post subject: Reply with quote

Thanks for the reply.

Perhaps you could provide an addon for "prototype" victims like me Rolling Eyes ?
eventually something like a browsercheck for ie, so when ie is detected the box is expanded by default.
Like you did for the Printer Friendly mod.
Until ie7 or they change some routines in prototype.js

Greetings
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Sun Feb 19, 2006 3:33 pm    Post subject: Reply with quote

Well, we could simply disable the "expand/contract" feature for IE.

OPEN: templates/select_expand_bbcodes.js

FIND:
Code:
function SXBB_IsOverflowAble()
{
   // Reliable overflow usage seems to require correct DOM support with some exceptions:
   // - Opera5/6 renders 'auto' as if it was 'visible'. Bang!
   // - IEMac seems to be buggy in some circumstances:
   //   http://sonofhans.net/mac_ie5_bug/
   //
   if( document.getElementById && document.childNodes && !SXBB_IsIEMac() )
      return true;
   return false;
}


REPLACE WITH:
Code:
function SXBB_IsOverflowAble()
{
   // disable this feature for MSIE.
   if( document.all && !window.opera )
      return false;

   // Reliable overflow usage seems to require correct DOM support with some exceptions:
   // - Opera5/6 renders 'auto' as if it was 'visible'. Bang!
   // - IEMac seems to be buggy in some circumstances:
   //   http://sonofhans.net/mac_ie5_bug/
   //
   if( document.getElementById && document.childNodes && !SXBB_IsIEMac() )
      return true;
   return false;
}


I believe that may do the trick. It's just a quick hack that will disable the Expand/Contract feature for MSIE. document.all is supported by Opera too, so there is a check for that. Probably Opera is not affected by that bug.

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Sun Feb 19, 2006 8:09 pm    Post subject: Reply with quote

Works?
 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Mon Feb 20, 2006 12:10 am    Post subject: Reply with quote

ehh, sorry for delay Wink

Yes it works fine for Ie (quote is expanded) and FF (quote is collapsed)
At opera i'm not sure. some version behave like FF some like IE.
But Operas behavior is not important.

So i use this workaround.

Thanks.
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Mon Feb 20, 2006 12:42 am    Post subject: Reply with quote

Yup! I forgot opera emmulates document.all. I have modified my previous post, adding a check to filter opera, which is probably not affected by the bug. I haven't made tests. It's just a quick hack.

PS: When checking for specific browsers, since the userAgent string can be easily spoofed, when possible, I try to use object detection methods to do the same job. But you never know for sure...

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Mon Feb 20, 2006 9:52 am    Post subject: Reply with quote

just tested with Opera 8.52.
This Opera version works like FF and displays <expand>

So only IE filter is needed and this works for IE.

Ok, now waiting for IE7 Smile
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Wed Feb 22, 2006 3:28 am    Post subject: Reply with quote

Jane Doe wrote:
Ok, now waiting for IE7 Smile

You can get the beta preview from here:
http://www.microsoft.com/windows/ie/ie7/

You can also follow what the IE Developers do from their blog:
http://blogs.msdn.com/ie/

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Thu Feb 23, 2006 10:59 am    Post subject: Reply with quote

I have problems with installing english ie7 and german xp.
Have to wait for a german ie7 beta to test.
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Tue Mar 07, 2006 8:41 pm    Post subject: Reply with quote

Hey, I just thought about a different approach, it might worth testing...

That is, get the original copy of select_expand_bbcodes.js and simply do this:

FIND:
Code:
var SXBB = [];


REPLACE WITH:
Code:
var SXBB = {};


Works? If not, well, just revert back to what we tried to date. However, it might work. SXBB was declared as an array and what we try now is declare it as an object, the for(var id in SXBB) loop should work in both cases, but maybe the second approach avoids the conflict with those libraries overriding Array.prototype... Question

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Jane Doe
Apprentice
Apprentice


Joined: 18 Feb 2006
Posts: 8

PostPosted: Wed Mar 08, 2006 1:32 pm    Post subject: Reply with quote

hmm,
Yes Very Happy
works in IE 6, FF and Opera.

Thanks a lot. Dance
 
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    phpMiX.org Forum Index -> phpBB MODs -> Select Expand BBCodes All times are GMT + 1 Hour
 
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum