Allen, Good point, and per your email, another good point on the early return statements in mine. i based that on a model i saw in other examples, intended to prevent calling Prototype methods on elements that don't exist (i.e. $('elementID') returns undefined).
i guess i tend to think more in an as-i-need-it way, which is admittedly bad form. i try to be forward-flexible, but don't always see beyond necessity. /slaps own wrist -joe t. On Aug 12, 10:26 am, Allen <bla...@gmail.com> wrote: > Just to clarify, the 4 visibility values are visible, hidden, > collapse, and inherit. IE does not support collapse and inherit. As > long as you don't use collapse and inherit, then you will experience > no problems. However, to be future compatible there would need to be > some sort of support in how collapse and inherit are handled. > > On Aug 12, 10:17 am, "joe t." <thooke...@gmail.com> wrote: > > > Allen makes a good point on distinct method names, but i had my > > mutation of these written before i knew better, and mine simply wrap > > the existing methods and look for a "truthy" argument to indicate > > using visibility instead of display. Also, mine use my CSS class names > > for the visibility switch: > > > Element.addMethods({ > > hide:Element.Methods.hide.wrap(function(proceed,element,visibility){ > > if (!(element = $(element))) {return;} > > if (!visibility) {return proceed(element);} // Aliased call to > > original hide() method > > else {return element.addClassName('invisible');} // Could also be > > element.style.visibility="hidden"; > > }), > > show:Element.Methods.show.wrap(function(proceed,element,visibility){ > > if (!(element = $(element))) {return;} > > if (!visibility) {return proceed(element);} // Aliased call to > > original show() method > > else {return element.removeClassName('invisible');} // Could also > > be element.style.visibility="visible"; > > }) > > > }); > > > Interesting that there are others out there attempting this kind of > > patch, but Allen's point about IE does make it tricky. So far, these > > have worked for me in IE and others. > > -joe t. > > > On Aug 12, 12:12 am, PhilPantin <filip.per...@gmail.com> wrote: > > > > Bonjour, > > > J'ai ajouté ce code à mon prototype 1.6.0.3, je pense qu'il pourrait > > > être utile, mais les procédures traditionnelles (git et cie) sont un > > > peu complexes pour moi. Merci si quelqu'un peut transmettre. > > > Et longue vie à Prototype ! > > > > Hi, > > > I had this code to my prototype 1.6.0.3, I think it could be usefull, > > > but the way to had it in the frameword by git and co are a little > > > difficult to me. Thanks if a awesome person could transmit. > > > Have fun with Prototype ! (sorry for my english) > > > > In Element.Methods : > > > (même noms que pour display, avec "v" au bout pour "visibility") > > > (same names as for display, with "v" at the end, "v" for "visibility") > > > > [code] > > > /*-- > > > Todo: To toggle the visibility the same way as display > > > --*/ > > > togglev: function(element) { > > > element=$(element); > > > Element[Element.visiblev(element) ? 'hidev' : > > > 'showv'](element); > > > return element; > > > }, > > > visiblev: function(element) { > > > return $(element).style.visibility != 'hidden'; > > > }, > > > hidev: function(element) { > > > element = $(element); > > > element.style.visibility = 'hidden'; > > > return element; > > > }, > > > showv: function(element) { > > > element = $(element); > > > element.style.visibility = 'visible'; > > > return element; > > > }, > > > [/code] > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---