[Prototype-core] Re: Style Guide for rewrite branch
Here is my take, I'm also altogether with this incoming pattern. PDoc blocks could indeed demarcate those sections, and be used to provide (browser|feature)-specific technical documentation. My proposal is the following (http://gist.github.com/25421), where by method appear : - classical implementation, with real name. - alternative implementations (with meaningful suffixes: UsingThis, FixingThat) - complex tests in named functions, suffixed by ShouldUseThis, ShouldFixThat as convention ? - branching, i.e. replacing function referenced by final name, depending on the return value of complex tests and inline trivial tests. It also shows an imaginary implementation of: PDoc tag. About complex shared tests, what are actual real cases ? Are such tests shared among parts (say files in rewrite branch) or pretty much isolated ? A solution might be to declare all common tests first, not really consistent with my previous proposition though... Another interresting point is usage of early or late binding when calling methods from other methods within the same closure (i.e. http://gist.github.com/25430) Early binding makes Prototype methods sort of frozen, but it looses some dynamism. Another better example is Enumerable, when all methods are written in term of `each` or an higher-level iterator. Should we write `this.each(...)` in `collect` code, or `each.call (this, ...)` ? `_each` being the only method that really has to be late-bound. Best, Samuel Lebeau On 13 nov, 20:25, Andrew Dupont [EMAIL PROTECTED] wrote: Here's what this would look like when genericized into an imaginary API:http://gist.github.com/24571 A couple of things: (1) I'm altogether in favor of this new approach, but it will result in less implicit organization of code. A reader of the code will likely find it harder to scan for the specific method they're looking for. We'll probably have to address this by marking code sections with comments. (2) Also, it now becomes less clear where a PDoc block would go. Technically, it would go at the bottom, where the external API is created, but that'd separate it from the logic of the function and would therefore make it more likely for the code and the docs to get out of sync. (Perhaps PDoc blocks can be used to demarcate, thereby solving both of these problems.) (3) Simple capability/quirk checks, as in the String#escapeHTML example, can go directly into the conditional. More complex checks, like the kind kangax has been working on, will need to be wrapped in anonymous functions and distilled into booleans. I'd prefer these booleans to have the naming conventions of constants (e.g., TREATS_ATTRIBUTES_AS_EXPANDO_PROPERTIES) so that they can be recognized easily in the code. Cheers, Andrew On Nov 13, 6:28 am, T.J. Crowder [EMAIL PROTECTED] wrote: Hi Tobie, I'm actually interested in the pattern, not in the actual code. Yeah, just wanted to make sure we were looking at the right code first. I investigated a bit more re the typos you mentioned. It happens to be an issue with gist which... escaped some of the strings. Lovely. So stating the obvious: The basics are: 1. Use named functions for each variant. 2. Define the functions up front. 3. Test proactive, in an appropriate order, and use the first one that works correctly. Right? -- T.J. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] методы загрузки prototype
столкнулся с такой проблемой... нужно загружать prototype через ajax, т.е. до него уже есть в памяти небольшая билиотечка сугубо для таких дел. но. prototype не будет так грузится безз дополнительной свистопляски, особенно в IE. например, с ExtJs таких проблем нет, там все идет так Ext = { // и пошлепал определять все }; потом от Ext все идет. так вот. а Prototype полно упований на того что его загрузили прямо через script/script, в глобальном нэймспэйсе... вот в этом вся хрень... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: mouseleave and mouseenter
here's a version that uses custom events: http://neverninetofive.com/mouseenterleave/ Nick, hope you don't mind, i borrowed your testing template. On Sep 21, 12:59 pm, Nick Stakenburg [EMAIL PROTECTED] wrote: That will probably give you some problems with textarea's and input elements. I've created a patch that allows observe to handle mouseenter and mouseleave so you can do: $(element).observe('mouseenter', function() { alert('entered'); }); $(element).observe('mouseleave', function() { alert('left'); }); patch:http://prototype.lighthouseapp.com/projects/8886/tickets/350 demo:http://www.nickstakenburg.com/tests/enterleave/ -- Nick On 19 sep, 14:41, Julien [EMAIL PROTECTED] wrote: Element.addMethods({ onmouseenter: function(element,observer) { element = $(element); element.observe('mouseover', function(evt,currentTarget) { var relatedTarget = $ (evt.relatedTarget || evt.fromElement); if( relatedTarget! =currentTarget relatedTarget.childOf(currentTarget)==false ) observer(element); }.bindAsEventListener({},element)); return element; }, onmouseleave: function(element,observer) { element = $(element); element.observe('mouseout', function(evt,currentTarget) { var relatedTarget = $ (evt.relatedTarget || evt.toElement); if(relatedTarget! =currentTarget relatedTarget.childOf(currentTarget)==false )observer(element); }.bindAsEventListener({},element)); return element; } }); it's work On 19 sep, 13:12, Julien [EMAIL PROTECTED] wrote: Hello I want to include dom event mouseleave and mouseenter on prototype 1.6.0.2. Anyone have a idea to include it ? Thanks. Regards,- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Hi Dears,
I want to chat with you on google talk,. I love you, --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Hi Dears,
I want to chat with you on google talk,. I love you, --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: writeAttribute and IE7
Alright, but the way trying to set this Element over new Element() also doesn't work. IE7 won´t do it. On Jun 23, 1:44 pm, artemy tregoubenko [EMAIL PROTECTED] wrote: Afaik, IE won't let you change type of an input after input is created. You need to create input with correct type. This can be done like this: var a = new Element('input', {type: 'password'}) On Mon, 23 Jun 2008 14:28:55 +0400, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: So, I have a problem while using writeAttribute for changing the type of an input field. Here is my code: $(id).writeAttribute({type: 'password'}); or $(id).writeAttribute('type', 'password'); Works fine with FF but IE7 tells that this command won´t be supported. Does anyone knows something about it? -- arty (http://arty.name) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] writeAttribute and IE7
So, I have a problem while using writeAttribute for changing the type of an input field. Here is my code: $(id).writeAttribute({type: 'password'}); or $(id).writeAttribute('type', 'password'); Works fine with FF but IE7 tells that this command won´t be supported. Does anyone knows something about it? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Utility method and frames
Hi JDD, On 27 Apr., 18:00, John-David Dalton [EMAIL PROTECTED] wrote: Hello Steffen , For future reference, this post should have gone to the users mailing list:http://groups.google.com/group/rubyonrails-spinoffs thx, it was my first post here so i have to learn structure of this groups ;-) Here is a patch to make Prototype more iframe friendly:http://dev.rubyonrails.org/ticket/11475 ok, i will look at it, thx. Your usage of the dom:loaded observer is incorrect. Should be something like: document.observe(dom:loaded, function(){ $(parent.document.body).select('a.csh-link').each( I believe both documents should be on the same domain as well. :) - JDD it's inside TYPO3, so all frames are inside same domain. The problem is that i have to add the observer on the main document, which has iframes inside. So I don't know which documents are loaded in the iframes, but they all content the kinks with this class. So i searched for a method to enumerate all links of this class in the parent documents. May be there is a way to go through all frame objects from parent to add the handlers for there documents? vg Steffen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] How to get the request parameters from the response?
Hi, I am using ajax.request(...) and would like in the onSuccess function to do some logic based on the parameters I sent in the request (think about a field name to be validated and I would like th update it's div using name convention). How can i have acess to it? In dojo you could add it to the request as an additional option: FieldName: field.name, and then get it using: options.fieldName Is there anything in prototype? Cheers, Shy. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] OpenAjax support
Hi all, Does anyone know if there is an intention to implement openAjax support standard in the future? Cheers, Shy --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: problem with event
Hi I do not know what is your problem, and I can not repeat your problem on my firefox 3.0 beta2, maybe it is only a problem for event sequence in firefox 2.0, try to fire the click in the window.onload event, maybe it can fix On Jan 6, 8:05 pm, 七星海 [EMAIL PROTECTED] wrote: using Prototype-version: 1.6.0 Firefox: 2.0.0.11 winXP Code: body div id=btnTestDivinput type=button name=test value=test id=btnTest //div /body script $(btnTestDiv).observe( click, function(e){ alert( this.nodeName + | + e.target.nodeName ); } ); $(btnTest).click(); first alert result: DIV | #document $(btnTest).click(); second alert result: DIV | INPUT /script Is this a problem? I think the first alert result is the same as the second alert result. Thank you! Aimin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Javascript closures question
Hi Simon, It is very easy, just go to search about JavaScript Function Declaration and Function Expresion (which Jscript doesn't support), it is just function and scope, yes JS is an amazing language which support this kind of feature, so do not say anything like annonymous function, there is no annonymous function, just Function Declaration and Function Expression and the Expression which IE and Jscript doesn't support. On Jan 9, 10:02 am, Simon Thomas [EMAIL PROTECTED] wrote: Ye sorry Mislav, Haven't found a decent Javascript discussion group/forum. Been playing around with Prototype recently, just figured this would be a good place to ask. I don't use Rails myself, Php, Mysql and Javascript developer mainly. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] EditInPlace Prototype ID issue
Hi, is there an issue with PrototypeJS? I am using the latest version of EditInPlace and PrototypeJS 1.6 and I cant use the same ID for more than one element when i want to do inline editing. is this a known issue or has this got to do with something else? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Bug from prototype?
Hello all, I'm using the prototype.js in my application and i have an error: Error: element has no properties Source File: http://www/application/js/prototype.js Line: 3844 function getEventID(element) { if (element._eventID) return element._eventID; arguments.callee.id = arguments.callee.id || 1; return element._eventID = ++arguments.callee.id; } Am I doing something wrong or is this a known bug? P.S.:Sorry for my poor english ok?! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Bug from prototype?
=btApi value= API class=styled onclick=show_api()/div /div !--- UPDATE DIV --- div id=cli_upd style=display:none align=center h4Atualizar Cliente/h4 FORM method=POST action=cliente_doupd.php id=frm_upd name=frm_upd input type=hidden value={$cliente-NR_CLIENTE|regex_replace:/\s+ $/:} id=codigo name=codigo class=input_mask mask_codigo TABLE border=1 width=90% trtd colspan=2Código:{$cliente-NR_CLIENTE|strip:''}{if $cliente- EMAIL|regex_replace:/\s+$/: !=}span class=alert(bloqueado)/ span{/if}/td/tr trtdNome:INPUT type=text name=nome id=nome size=80 value={$cliente-NOME|regex_replace:/\s+$/:} class=styled onblur=validate_nome(this)/tdtd Email:{$cliente-EMAIL| regex_replace:/\s+$/:}/td/tr trtd colspan=2Endereço:INPUT type=text name=endereco id=endereco size=60 value={$cliente-ENDERECO|regex_replace:/\s+ $/:} class=styled onblur=validate_endereco(this)/td/tr trtdTel. Res.: INPUT type=text name=telres id=telres value={$cliente-TEL_RES|regex_replace:/\s+$/:} class=styled/ tdtdData:span id=data_span{$cliente-GEN1|regex_replace:/\s+ $/:}/spanINPUT type=hidden name=cli_gen1 id=cli_gen1 value={$cliente-GEN1|regex_replace:/\s+$/:} class=stylednbsp;nbsp;A HREF=# onClick=setCalendar(cal1x, 'anc','cli_gen1','{$cliente-GEN1|regex_replace:/\s+$/:}'); return false; TITLE=Clique para escolher a data NAME=anc ID=ancEscolha a data/A/td/tr trtdTel. Com.: INPUT type=text name=telcom id=telcom value={$cliente-TEL_COM|regex_replace:/\s+$/:} class=styled/ tdtd Nodo:select id=cli_gen2 name=cli_gen2 class=styled {foreach from=$nodos item=nodo} option value={$nodo-DENOMINACAO} {if $cliente-GEN2| regex_replace:/\s+$/: == $nodo-DENOMINACAO }selected{/if}{$nodo- DENOMINACAO}/option {/foreach} /select/td/tr trtdTel. Cel.: INPUT type=text name=telcel id=telcel value={$cliente-TEL_CEL|regex_replace:/\s+$/:} class=styled/ tdtd Provedor:INPUT type=text name=cli_gen3 id=cli_gen3 value={$cliente-GEN3|regex_replace:/\s+$/:} class=styled/ td/tr /TABLE /FORM br div align=centerinput type=button name=btEdt value= Salvarclass=styled onclick=cliente_save()nbsp;input type=button name=btCancel value= Cancelar onclick=cliente_cancel() class=stylednbsp;input type=button name=btFnd value=Procurar class=styled onclick=cliente_find()nbsp;input type=button name=btApi value= API class=styled onclick=show_api()/div /div {literal} script language=javascript show_cm(); /script {/literal} div id=cm_div align=center /div {literal} script language=javascript show_cpe(); Xaprb.InputMask.setupOneElementMask(document.getElementById('')); /script {/literal} div id=cpe_div align=center /div {/if} DIV ID=caldiv STYLE=position:absolute;visibility:hidden;background- color:white;layer-background-color:white;/DIV div id=UpdateProgress style=display:none Aguarde, executando comando... /div script WindowCloseKey.init(); /script /body /html Im using http://prototypejs.org/assets/2007/10/16/prototype.js , the firebug show me: getEventID(null)prototype.js (line 3812) createWrapper(null, keypress, function())prototype.js (line 3832) observe(null, keypress, function())prototype.js (line 3876) setupOneElementMask(null)masks.js (line 99) if (element._eventID) return element._eventID; Regards, ThEcHaCaL P.S.: ( pastie.caboo.se ) didnt work here =/ On Dec 4, 10:48 am, Mislav Marohnić [EMAIL PROTECTED] wrote: We don't know if you're doing something wrong because you haven't told or shown us what you are doing. But, the code you are referring to is pretty internal to event handling, so I don't think you might be doing something wrong. What we need from you if full code where this happens (use pastie.caboo.sefor pasting), as well as exact browser information. If you could make a minimal document where this error happens so we could reproduce it, it would help us resolving the issue quickly. Thanks! On Dec 4, 2007 1:18 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello all, I'm using the prototype.js in my application and i have an error: Error: element has no properties Source File:http://www/application/js/prototype.js Line: 3844 function getEventID(element) { if (element._eventID) return element._eventID; arguments.callee.id = arguments.callee.id || 1; return element._eventID = ++arguments.callee.id; } Am I doing something wrong or is this a known bug? P.S.:Sorry for my poor english ok?! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Improvement of either .insert, or creating of Elements
I have been trying to figure out a way that I can insert multiple elements into the document, without having to use the Element.insertion method every time which obviously isn't an efficient way to do it. Therefore I had to create an element in string (html form) and then concate them togetether and then insert it which is much faster. The problem is this doesn't allow me to retrieve the element for later use later, which up to now wasn't a problem. So I have been messing around with the Element Builder, which isn't useful for me. The fact that you cannot create an element from a html source isn't helping me. To conclude, one suggestion that I have for the future is a way to insert multiple Elements using an array argument for the insertion method, or make another method for creating a new element from a html source string. I may be wrong in this, but at the moment I cannot think of a better way around this, perhaps there is a solution I haven't thought about. Another thought that just come to me now is, whether there isn't an actual deficiency in your insertion methods, because doesn't it using native Dom methods to insert an element? Thanks for your time to answer this. Luke Parry --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Improvement of either .insert, or creating of Elements
I just did some tests, just to show the differences between. time to insert 10,000 span with hello + i KONQUEROR: concated string method: 3614ms insertion every iteration: 62510 ms FIREFOX 2: concated string method: 574ms insertion every iteration: 71924ms I haven't tested this on Opera, Safari, IE, but I bet the results will be similary out-disreportional. And I know 10,000 elements is extreme, but to be honest some people iterate quite a few elements... Here is my method of testing... var i = 1, content = ''; //FIRST TEST CONCATED STRINGS var start = date.getTime(); document.body.update(''); while(i) { content += 'spanhello' + i + '/span'; i--; } document.body.insert(content); var end = new Date(); //SECOND TEST INSERTION EVERY ITERATION var start = new Date(); document.body.update(''); while(i) { document.body.insert('spanhello' + i + '/span'); i--; } var end = new Date() alert((end - start)); I don't want to annoy anyone on this, but it just strenghens why I needed to concate the elements, which is causing my problems... On Nov 4, 2:44 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have been trying to figure out a way that I can insert multiple elements into the document, without having to use the Element.insertion method every time which obviously isn't an efficient way to do it. Therefore I had to create an element in string (html form) and then concate them togetether and then insert it which is much faster. The problem is this doesn't allow me to retrieve the element for later use later, which up to now wasn't a problem. So I have been messing around with the Element Builder, which isn't useful for me. The fact that you cannot create an element from a html source isn't helping me. To conclude, one suggestion that I have for the future is a way to insert multiple Elements using an array argument for the insertion method, or make another method for creating a new element from a html source string. I may be wrong in this, but at the moment I cannot think of a better way around this, perhaps there is a solution I haven't thought about. Another thought that just come to me now is, whether there isn't an actual deficiency in your insertion methods, because doesn't it using native Dom methods to insert an element? Thanks for your time to answer this. Luke Parry --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] anyone else having problems with adBlock plus?
If I use prototype to mess around with my textarea's style while running the adBlock Plus plugin in firefox everything runs fine. Until: I move away from the page either by going to another page, closing the tab or closing the window. Then Firefox crashes. I've done a little DHTML before, modifying styles with javascript, and I've never had this problem with adBlock before. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] $$ function needs context attribute?
In the jQuery the $ function have two attributes the second is context, and it is very useful, for example: $(div).each(function(){ $(img,this).hide() $(.,this).dosomething() }) And in the Prototype there is also Selector.findChildElements and the first attribute is the context, and this function is not recommended for the end users to use, I think is is good to create a new function called $$$ or something like that to make a short selector function and supports context. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $$ function needs context attribute?
Oh, the select method, I haven't use it, and the context is important for the css selector, and in the case Selector.findChildElements supports the context, So only change the $ $ function and to check whether the last argument is HTML element or not is enough. And context is really very important for css selector, it make the selector much more flexible.especially in the $$().each(function(node){ $$(,node).doSomething() }) On Oct 17, 6:43 pm, Mislav Marohni [EMAIL PROTECTED] wrote: On 10/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I think is is good to create a new function called $$$ or something like that to make a short selector function and supports context. We use Element#select to constrain the lookup to a certain element: $(foo).select(img) We discussed adding a context argument to $$ a while ago, but it just didn't turn out worthwhile, I guess. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: combinator selectors in Element#select
Please make it to be simple, look at the source code: select: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args); }, the select method is only a wrapper of the Selector.findChildElements, and with different selector context. For the css selecting rule as same with the css with $$, make it to be complex is not a good idea. On Oct 17, 10:47 pm, kangax [EMAIL PROTECTED] wrote: I recently stumbled upon a href=http://dev.rubyonrails.org/ticket/ 9465this ticket/a In a nutshell, element.select(' foo') does not return the correct result while element.select('foo') does. I understand that combinator selector should be defined between two simple ones (so it's not quite a valid expression), but the question is do we want to allow this kind of thing? Is it an edge case? Should we make this work or just fall back to an alternative way? i.e. element.childElements().map(function(el){ return el.match('foo') }) Best, kangax --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: :not() selector bugs
I fixed the fix. I'm not sure how to make a properly formatted diff though. the issue was |(?=\s)|(?=:) needed to be (?=(\s|:)) http://dev.rubyonrails.org/attachment/ticket/9696/selector.diff?format=txt --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: *Bug* - transport.responseJSON doesn't work with konqueror
Okay, I have assigned a ticked for this: http://dev.rubyonrails.org/ticket/9824 Hope that helps even more Luke On Oct 8, 10:00 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hey there, thanks for responding so promptly :) Tobie, I have tried to use t.getHeader('Content-type'); but returns undefined, and I have tried this with a plain Ajax.Request Object and still is the same for it... So yeah, the fact that it cannot get the response type means that it doesn't know that it should process it as json. I'll see if I can post a bug report on it now Luke On Oct 8, 12:40 am, Tobie Langel [EMAIL PROTECTED] wrote: Hi Luke, Thanks for the info. Mind opening a bug report for it ? That would be really helpful. Have you run the test suite on Konqueror, any ajax related tests failing ? I'm suspecting it might be an issue with the content headers, could you please let me know what you get for the following: t.getHeader('Content-type') Thanks, Tobie --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] *Bug* - transport.responseJSON doesn't work with konqueror
I just noticed today, because usually I use firefox, that using the responseJSON property incorrectly works with konqueror (3.5.7), however on the other hand using the prior method of evaluating the response text using evalJSON works fine - i.e. : t.responseText.evalJSON() //Works with konqueror t.responseJSON //Doesn't work with konqueror I know konqueror is probably insignificant to most people, but I want to ensure my project works for everything recent. So could this please be addressed :) Thanks Luke p.s Loving 1.6 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Error when using Prototype 1.6.0_rc0
I am having the exact same issue. The code just stops at handler.call(event.target, event); without throwing an error. It works fine in IE. On Aug 17, 3:13 am, Frederic Gaus [EMAIL PROTECTED] wrote: Hi Guys, first of all I want to thank all of you for producing such a great framework and so many great new futures for 1.6.0. I couldn't wait to try them out and replaced myprototype1.5.1 lib with the new 1.6.0rc0. I had to switch some things because I some of my constructs were conflicting with your implementation, but I hope this is all fixed now. But I have one error left infirefox(prototype.js, line 3868): handler.call(event.target, event); The error occures in the function createWrapper which is called really often. But only the first run causes this error. Any idea? Greetings Frederic -- Frederic Gaus pgp-key: 93E6903C fingerprint: 0C55 4517 CC1E 5F7F 9059 3535 AB54 D8E8 93E6 903C --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Error when using Prototype 1.6.0_rc0
I figured it out. I had a custom function similar to prototype's new 'delay' function. Removing my function fixed the issue. The strange part, was that no errors were being thrown. Firefox just stopped at handler.call. All is well now. On Oct 5, 10:53 am, Mislav Marohni [EMAIL PROTECTED] wrote: On 10/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am having the exact same issue. The code just stops at handler.call(event.target, event); without throwing an error. It works fine in IE. You realize that there's nothing we can do unless you provide us with a minimal failing test case or at least some code that you're using? Thanks --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Error in Opera (possible bug)
As a patch: Changing line 1548 in prototype.js from: results.push(query.snapshotItem(i)); to: results.push($(query.snapshotItem(i))); seems to solve this particular issue - I am not sure if that affects other things negatively or not... (again, this is the 1.6.0_rc0 version) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Thoughts about 1.6
I vote an emphatic No - this would be overhead within proto-core, which should remain as _baseline_ as possible (that's my rant and I'm sticking to it - proto is a baseline - don't bloat it... please!). I see that point - and that was the type of discussion that I wanted to spawn. I agree that the core should not be bloated at all...but exactly *what* should be in core or not? var oldInsert = Element.insert; Element.insert = function(...) {... fireYourCustomEvent() ... oldInsert(...)}; This is actually a pretty easy way to do that. I don't have a problem at all implementing this sort of thing outside of the prototype core. I was just originally thinking that it would help to move Prototype more towards its goal of creating a level-playing field of sorts - a core library that irons out all the little cross-browser quirks that exist (and mutation events are one of those...that was my original thinking). Thanks for the comments! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Thoughts about 1.6
var oldInsert = Element.insert; Element.insert = function(...) {... fireYourCustomEvent() ... oldInsert(...)}; Just for reference, the way that I got this to work in Prototype 1.6 was (hopefully this accounts for all cases): var prev = {}; [insert,remove,replace,update,wrap].each(function(s){prev[s] = Element[s]}); var add = { insert: function(){ var args = $A(arguments), element = $(args.shift()), insertions = args[0], fireEs = []; if (Object.isString(insertions) || Object.isNumber(insertions) || Object.isElement(insertions) || (insertions (insertions.toElement || insertions.toHTML))) insertions = {bottom:insertions}; for (position in insertions) { position = position.toLowerCase(); if (position == before || position == after) { fireEs.push($(element.parentNode)); } else { fireEs.push(element); } } var retVal = prev.insert(element, args); fireEs.each(function(e){ fireE.fire(nodeadded); fireE.fire(domchanged); }); }, remove: function(){ var args = $A(arguments), element = $(args.shift()), fireE = $ (element.parentNode); var retVal = prev.remove(element, args); fireE.fire(noderemoved); fireE.fire(domchanged); return retVal; }, replace: function(){ var args = $A(arguments), element = $(args.shift()), fireE = $ (element.parentNode); var retVal = prev.replace(element, args); fireE.fire(noderemoved); fireE.fire(nodeadded); fireE.fire(domchanged); return retVal; }, update: function(){ var args = $A(arguments), element = $(args.shift()); var retVal = prev.update(element, args); element.fire(domchanged); return retVal; }, wrap: function(){ var args = $A(arguments), element = $(args.shift()), fireE = $ (element.parentNode); var retVal = prev.wrap(element, args); fireE.fire(nodeadded); fireE.fire(domchanged); return retVal; } } Element.addMethods(add); --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Thoughts about 1.6
No one probably cares but me about this - but there were a few issues with the previous code...here is some that works, and is suitable for placing in an extension.js file: var prev = {}; [insert,remove,replace,update,wrap].each(function(s){prev[s] = Element[s]}); var add = { insert: function(element, insertions){ var fireEs = []; if (Object.isString(insertions) || Object.isNumber(insertions) || Object.isElement(insertions) || (insertions (insertions.toElement || insertions.toHTML))) insertions = {bottom:insertions}; for (position in insertions) { position = position.toLowerCase(); if (position == before || position == after) { fireEs.push($(element.parentNode)); } else { fireEs.push(element); } } var retVal = prev.insert(element, insertions); fireEs.each(function(e){ e.fire(nodeadded); e.fire(domchanged); }); return retVal; }, remove: function(element){ var fireE = $(element.parentNode), retVal = prev.remove(element); fireE.fire(noderemoved); fireE.fire(domchanged); return retVal; }, replace: function(element, content){ var fireE = $(element.parentNode), retVal = prev.replace(element, content); fireE.fire(noderemoved); fireE.fire(nodeadded); fireE.fire(domchanged); return retVal; }, update: function(element, content){ var retVal = prev.update(element, content); element.fire(domchanged); return retVal; }, wrap: function(element, wrapper, attributes){ var fireE = $(element.parentNode); var retVal = prev.wrap(element, wrapper, attributes); fireE.fire(nodeadded); fireE.fire(domchanged); return retVal; } } Element.addMethods(add); --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Inheritance code question
And, one thing is still very important, the object really does not have the constructor property function a(){} b=new a Object b.constructor==a true b.hasOwnProperty(constructor) false b.__proto__.constructor==a true b.__proto__.constructor a() and I really think the constructor property is no use at all. No one relys on the constructor property to get the real constructor function... On Sep 9, 8:29 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks very much, and I think this constructor property is really not very reliable, such as: function a(){} a.prototype={b:123} b=new a b.constructor==Object //true and: function a(){} a.prototype=new String(aaa); b=new a; b.constructor==String you can change the constructor before or after you constructing your object, not very reliable, and futhermore: function a(){return new String(aaa)} a.prototype.a=123; b=new a b.a //undefined b //String object aaa If you return an object in your constructor function, and all the created object will be ignored by the JavaScript interpreter. And except for get the real constructor function from the object's constructor property, I can see no reason to redefine it, it has no other usage at all. It can not change the prototype chain, it just define who is the constructor function and does not very reliable On Sep 9, 1:13 am, Robert Kati [EMAIL PROTECTED] wrote: When you create a new function it has a prototype property, which has a constructor property which refer to the created function: function F(){}; F.prototype.constructor === F = true So you will be able to get the class of an instance: var obj = new F; obj.constructor === F = true When we redefine the prototype property of an function, their constructor must be redefined too: function G(){}; G.prototype = new F; var obj = new G; obj.constructor === F // true !!not good!! G.prototype.constructor = G; obj.constructor === G // true - ok The special __proto__ property is available only on Gecko engines, and it is used to redefine the prototype chain... so it's not cross- browser solution... my module for OOP in JS use this optimization too, but it's not strictly necessary... I hope this answer will help you, Robert On Sep 8, 4:12 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have seen the new inheritance code from Alex in 1.60 rc0, and I have a question: I believe the following two lines code are no use at all method.prototype.constructor = method; subclass.prototype.constructor = subclass; constructor property is no use at all, the usage property is __proto__ and you can not alter it in IE, is there something I do not know about constructor property which is also very important?- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Inheritance code question
Thanks very much, and I think this constructor property is really not very reliable, such as: function a(){} a.prototype={b:123} b=new a b.constructor==Object //true and: function a(){} a.prototype=new String(aaa); b=new a; b.constructor==String you can change the constructor before or after you constructing your object, not very reliable, and futhermore: function a(){return new String(aaa)} a.prototype.a=123; b=new a b.a //undefined b //String object aaa If you return an object in your constructor function, and all the created object will be ignored by the JavaScript interpreter. And except for get the real constructor function from the object's constructor property, I can see no reason to redefine it, it has no other usage at all. It can not change the prototype chain, it just define who is the constructor function and does not very reliable On Sep 9, 1:13 am, Robert Kati [EMAIL PROTECTED] wrote: When you create a new function it has a prototype property, which has a constructor property which refer to the created function: function F(){}; F.prototype.constructor === F = true So you will be able to get the class of an instance: var obj = new F; obj.constructor === F = true When we redefine the prototype property of an function, their constructor must be redefined too: function G(){}; G.prototype = new F; var obj = new G; obj.constructor === F // true !!not good!! G.prototype.constructor = G; obj.constructor === G // true - ok The special __proto__ property is available only on Gecko engines, and it is used to redefine the prototype chain... so it's not cross- browser solution... my module for OOP in JS use this optimization too, but it's not strictly necessary... I hope this answer will help you, Robert On Sep 8, 4:12 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have seen the new inheritance code from Alex in 1.60 rc0, and I have a question: I believe the following two lines code are no use at all method.prototype.constructor = method; subclass.prototype.constructor = subclass; constructor property is no use at all, the usage property is __proto__ and you can not alter it in IE, is there something I do not know about constructor property which is also very important?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] iterable/$A
for copying arrays and/or converting iterables like 'arguments' to arrays, // arguments - array newArray = Array.slice( arguments ); // copy a-b copy = Array.slice( original ); --- provides a small increase in speed for a variety of array operations contained in prototype also for array iteration: // declare var outside of loop -- slightly faster... var i; for( i=10; i--; ){ // execute code here } --- in cases where order is not relevant, this method benchmarks faster than any other in all browsers tested ( *safari/mac not tested ) also, for generating unique arrays: function uniqueArray( array ){ var uniqueHash = {}, unique=[], i; for( i=array.length; i--; ){ if( !uniqueHash[ a[i] ]){ unique.push( array[i] ); uniqueHash[ a[i] ] = true; } } return unique; } and is there any reason not to use String.replace([regexp], function() {} ) for a large part of the functions implemented by iterating through arrays? this can be blazingly fast even for complicated regex as long as they are precompiled, and the code is far more readable and compact (i.e. camelization, templating, etc etc ) there are some other much more significant optimizations which might be worthwhile and i would appreciate feedback once i clean up the code a bit more... and --- a big kudos to the prototype team -- discovering prototype way back when completely changed the way i code javascript - thanks. ss --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Suggestion: getElementsByClassName wrapper for firefox 3.0
How about as an extended element method? On Aug 24, 7:57 am, Mislav Marohni [EMAIL PROTECTED] wrote: On 8/24/07, Tobie Langel [EMAIL PROTECTED] wrote: I'm not saying we should do that, but can't we just wrap it HTMLElement.prototype too ? No, I tried :) We must go through HTMLElement, HTMLFormElement, HTMLTableElement ... each and every one. Crazy, yeah :D --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Suggestion: getElementsByClassName wrapper for firefox 3.0
Maybe the first thing is not to overwrite the native method, I agree with Mislav, to extend the NodeList.prototype maybe is the best choice, and overwrite in the element methods never want that thing On Aug 25, 12:35 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How about as an extended element method? On Aug 24, 7:57 am, Mislav Marohni [EMAIL PROTECTED] wrote: On 8/24/07, Tobie Langel [EMAIL PROTECTED] wrote: I'm not saying we should do that, but can't we just wrap it HTMLElement.prototype too ? No, I tried :) We must go through HTMLElement, HTMLFormElement, HTMLTableElement ... each and every one. Crazy, yeah :D- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Bug?
4014: src='://javascript:void(0)'\/script); shouldn't this be: 4014: src='http://javascript:void(0)'\/script); ie6 was tossing errors on-load, but only when mod-rewrite was turned on and my server was dumping a full web page back to this request, which shouldn't even hit the server, right? :) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Unique Arrays
Hello, I enhanced 1.4.3 for db.etree.org. Among my changes is this, which I feel is useful enough to include with Core: unique: function (){ var temp=new Array(); this.sort(); for(i=0;ithis.length;i++) { if(this[i]==this[i+1]) {continue} temp[temp.length]=this[i]; } return temp; }, Thank you, Tom H Anderson --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Event.observe should fix this problem in attachEvent
Quite a lot changes for event part of Prototype, onReady and closure fix for IE this reference bug, and add IE's standard DOM event model, BTW the MS has released the memory leak bug fix for IE6, and no memory leaks in IE7, so in this case, will the Prototype still need to add the onunload event to clear the memory? Wait for the next release. On Jul 22, 12:33 pm, Tobie Langel [EMAIL PROTECTED] wrote: Sorry, here's the link for it:http://dev.rubyonrails.org/browser/spinoffs/prototype/branches/event On Jul 22, 12:30 am, Tobie Langel [EMAIL PROTECTED] wrote: Have a look at the event branch for this. On Jul 21, 11:57 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You must know the attachEvent can only put a function to be a element's event handler, andd in that function this should be the element itself, but the internet explorer linked it with window object, and Event.observe doesn't fix this bug, same as $ input's name bug, I think the Prototype library should fix it, my modification: . _observeAndCache: function(element, name, observer, useCapture) { if (!this.observers) this.observers = []; if (element.addEventListener) { this.observers.push([element, name, observer, useCapture]); element.addEventListener(name, observer, useCapture); } else if (element.attachEvent) { var f=function(){observer.call(element,window.event)};// this line I add this.observers.push([element, name, f, useCapture]); element.attachEvent('on' + name, f); } }, . use closure to fix this bug, I think this should be added into Prototype, any ideas?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] String.strip enhancement
Hello, I'd like to point you at this ticket : http://dev.rubyonrails.org/ticket/8757 Based on my reading of http://blog.stevenlevithan.com/regular-expressions/faster-trim-javascript/ (I didn't benchmark the implementations myself), I'd liek to suggest a replacement for the current strip() method : this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); Instead of the actual implementation which is : this.replace(/^\s+/, '').replace(/\s+$/, ''); Thanks, Moal Jean-Philippe PS : I'm new on this list, sorry if this isn't the actual development discussion process. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
I'd like to add a bit of OT to the discussion, but relating to the $ function itself. Currently, $ wil not return an element, whose id is a number, whereas getElementById will. The fix, as you can imagine, is pretty simple. I myself just changed the following line: if (typeof element == 'string') to: if (typeof element == 'string' || typeof element == 'number') I don't know if this is the most optimized way though. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
My solution, maybe too complicated, one path for opera which is pretty good and with good performance, the path for internet explorer which is complicated, and for my testing it is stable, hope it can make $ to be much more cross-browser, I believe the js framework should fix the browser's bug, the path for ie won't work on opera and of course the path for opera won't work on ie, complicated. function $(element) { if (arguments.length 1) { for (var i = 0, elements = [], length = arguments.length; i length; i++) elements.push($(arguments[i])); return elements; } if (typeof element == 'string') { var id=element; element = document.getElementById(element); var tmp=[]; var t=document.getElementById(id); if (Prototype.Browser.IE) { while(t!=null t.id!=id) { var e=t.outerHTML; t.outerHTML=t.outerHTML.indexOf('name=')!=-1? t.outerHTML.replace('name='+t.name+'','name='+t.name +'_tmp_'):t.outerHTML.replace('name='+t.name,'name='+t.name+'_tmp_') tmp.push([document.getElementById(t.name+_tmp_),e]) t=document.getElementById(id); } tmp.each(function(node){node[0].outerHTML=node[1]}); } else if(Prototype.Browser.Opera) { while(t!=null t.id!=id) { tmp.push([t,t.name]) t.name+=_tmp_; t=document.getElementById(id); } tmp.each(function(node){node[0].name=node[1]}); } element=t; } return Element.extend(element); } On Jun 18, 3:01 pm, Mislav Marohnić [EMAIL PROTECTED] wrote: On 6/18/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: input type=text value=this should be returned name=test id=www / input type=text value=this should not be returned ff2.0 bug not appeared in ff3.0 a5 name=test id=www / This is not valid HTML. It has 2 different elements with the same ID, in which you get unexpected behavior with getElementById. 1.In ie the only way to change a input element's attribute name is to change outerHTML? Yes, you are basically re-writing the element. That is never smart. 3.Is there a regular expression to get out the name attribute from these two strings 'input type=button value=aaa lll name=lll /' and'input type=button value=aaa lll name=lll l /' one name with one without, and the method to modify it. Thanks Of course there is, but there is no sense in making it. I think you now need to stop trying to solve this with outerHTML because it's just plain wrong and you'll just have problems down the line. There are only 3 possible options we're facing: 1. Don't change the $ function, leave everything as-is; 2. Fix the issue in $ by using $$('*[id=foo]'); 3. Don't fix the issue, throw error instead. I don't believe we need to discuss anything else but these. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
The only solution that could be faster than this is to temporary delete the name of the found element and repeat the $() call, after which the name would be restored. Unfortunately it isn't possible. I think my solution is something like what you said, I doubt it will get a better performance, especially in ie, so many outerHTML changing, and for $ function, because this is really an edge case, $$(*[id=...]) should fix it only the performance hit, ie and opera's misbehaving on the input's name is unreasonable, so correcting it by $$ should be the best. And for my solution, it is too ugly, I won't use it, just prove you can change the name and fix it. On Jun 18, 5:33 pm, Mislav Marohnić [EMAIL PROTECTED] wrote: On 6/18/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: My solution, maybe too complicated, one path for opera which is pretty good and with good performance, the path for internet explorer which is complicated, and for my testing it is stable Your solution may suit you but we will not accept anything that messes with the document. So now let this discussion go in the direction of the 3 items I suggested. No alternative solutions will be accepted (unless they are something brilliant we haven't thought of before). --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
Tks, I quite do not understand outerHTML, oh this would remove all the event handlers, in opera only change name attribute won't remove the event handlers? I think so. IE, misbahaving make me confused on you, why does IE implement the DOM basic method like this, any reasonable reason? Thanks ;) On Jun 18, 6:07 pm, Tobie Langel [EMAIL PROTECTED] wrote: And for my solution, it is too ugly, I won't use it, just prove you can change the name and fix it. Ya, unfortunately, in the process you've also removed any event handler that could have been set on the element. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
Not only IE and Opera, of course firefox, look at this code script src=prototype.js/script input type=text value=this should be returned name=test id=www / input type=text value=this should not be returned ff2.0 bug not appeared in ff3.0 a5 name=test id=www / script alert($(www).value) window.setTimeout(function(){alert($(www).value)},1000) /script This page give out the same result on ie opera safari, but in ff2.0, the second alert return the second id matched element, and I have downloaded the ff3.0 alpha5, it give the result which the ie opera gives, and be different with ff2.0, so I believe this is may be a gecko 1.8* rendering problem, and be fixed in the gecko 1.9*, even the firefox has some problems on getElementById, so do not care too much about that thing. On Jun 18, 11:07 pm, Радослав Станков [EMAIL PROTECTED] wrote: I really think that name and id should be different no to overload $() with more functionality. Besides it is easy to catch such error if there are names equal to ids even in complicated JS scripts. here http://video.yahoo.com/video/play?vid=410472near 10 minute to see more problems with IE and Opera with getElementById p.s. In my last project I found that I was call $ over 7070 times when I pass throw main features in 3-5 minutes, and think on IE what will happen if we have additonal $$ or some stuff like that ! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Prototype Control Suite Object.Event
Hi everybody, my name is Ryan, I have new library called Object.Event, you can read about it here: http://livepipe.net/projects/object_event/ I am curious to get folk's reaction, and would be more than happy to contribute code and ideas towards the way 2.0 handles classes/objects and events. I haven't yet read through the group's history to see the evolution of ideas, so the code in that project is naive to that. I'm going to refrain from saying much more until I am more informed, but I just thought that the group might find these links interesting. Thanks - Ryan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
I think the most important thing is what is the goal of the $ function 1. if the goal is to create a shotpath function to the getElementById, so no changes will be done. 2.If the goal is let the people get the same result on cross browsers, and the $ function must add some checks and return the right element. 3.If the $ function have the responsibility of teaching people how to write good html code, it should just throw out a error message something like Maybe you are just using IE,and the IE is just misbehaving input's name with its id attribute, we suggest you check your html code, make all elements have the same value name and id attri so that is it. What is the $ function's goal judge how to fix it. On Jun 19, 4:36 am, Радослав Станков [EMAIL PROTECTED] wrote: Vote for #1 I think we as developers should think about the performance and code, and we should be aware of this traps . But to make fix which will be helpful for unaware people and lower the quality, I don't think It is a good idea. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
element = $$('*[id=' + id + ']').first(); should be the same with my element=$$(*).detect(function(node){return node.id==id}) is there some performance difference between these two code? Thanks On Jun 17, 9:14 pm, Adam McCrea [EMAIL PROTECTED] wrote: While I agree that it is bad practice to use names and id's which conflict, unfortunately we're not always scripting markup that we have control over. I do think this should be handled in prototype, and the ticket is here: http://dev.rubyonrails.org/ticket/6328 I recently reopened this ticket since it had been closed as a browser bug. Prototype smooths over so many browser inconsistencies that I don't quite understand that rationale. Hopefully it will be reconsidered since I added a patch with a test. The performance hit should only occur in an edge case in IE and Opera, so I don't see that as an issue. Even then, dollar-dollar is pretty fast these days, so I doubt it would be noticeable. If you have some suggestions regarding the patch, please add your comments to the ticket. - Adam On 6/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I do not think so, what about this case: script src=prototype.js/script input type=text value=ie bug name=test / input type=text value=this value should be returned id=test / script alert($(test).value) /script If use your $ in ie and opera it will return null, but it should return the element which has the id test element, so I use $$ and detect the first matched element. My purpose is let the $ function has the same result on all the browsers. No matter ie opera or firefox or safari On Jun 17, 8:00 pm, DK [EMAIL PROTECTED] wrote: I agree with jdalton - performance hit. I agree also that you shouldn't use the same values for name's and id's. $() is made for one purpose - to find elements with given id. It should be VERY fast in every case as it's a base function of Prototype. IMO, if found' element's id isn't the same as given, maybe function should even return null: [...] if (typeof element == 'string') { var id=element; element = document.getElementById(element); // not found if (element === null || !element.id || element.id!=id) { return null; } } return Element.extend(element); [...] On Jun 17, 11:36 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Wait for your solution, however this performance hit only occur in the ie and opera and you select the input without an id attribute, maybe 1%'s probability. Will $$(*).detect take a very long time? long than 2 seconds? Is that posibble? Thanks- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
What about this code: if(!element.id || element.id!=id) { var tmp=[]; var t=document.getElementById(id); while(t!=null t.id!=id) { tmp.push([t,t.name]); t.name+=_tmp_; t=document.getElementById(id); } element=t; tmp.each(function(node){ node[0].name=node[1]; }); } However the ie protect its input element and do not let setAttribute change its name attribute, only way to change it is to change outerHTML which is very ugly, so I believe $$(*).detect is the best way. On Jun 17, 9:34 pm, Mislav Marohnić [EMAIL PROTECTED] wrote: On 6/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: is there some performance difference between these two code? Thanks Using the CSS selector instead of Enumerable enables the use of XPath. But since IE doesn't support XPath and the hack above is for IE and Opera, I'd dare to say that there is no much difference in execution time. One more thing: $$('*[id=' + id + ']') Am I right when saying that this will fail if the ID was dynamically set (in other words, it was not an attribute in HTML source)? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
I rewrite it like this, I know this is very ugly someone can improve it? if(!element.id || element.id!=id) { var tmp=[];var y=100; var t=document.getElementById(id); while(t!=null t.id!=id) { var e=t.outerHTML; y++; t.outerHTML=hr id='+y+'; tmp.push([document.getElementById(y),e]); t=document.getElementById(id); } element=t; tmp.each(function(node){ node[0].outerHTML=node[1]; }); } However, it works, with the good performance which I believe. Thanks for reply On Jun 17, 11:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What about this code: if(!element.id || element.id!=id) { var tmp=[]; var t=document.getElementById(id); while(t!=null t.id!=id) { tmp.push([t,t.name]); t.name+=_tmp_; t=document.getElementById(id); } element=t; tmp.each(function(node){ node[0].name=node[1]; }); } However the ie protect its input element and do not let setAttribute change its name attribute, only way to change it is to change outerHTML which is very ugly, so I believe $$(*).detect is the best way. On Jun 17, 9:34 pm, Mislav Marohnić [EMAIL PROTECTED] wrote: On 6/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: is there some performance difference between these two code? Thanks Using the CSS selector instead of Enumerable enables the use of XPath. But since IE doesn't support XPath and the hack above is for IE and Opera, I'd dare to say that there is no much difference in execution time. One more thing: $$('*[id=' + id + ']') Am I right when saying that this will fail if the ID was dynamically set (in other words, it was not an attribute in HTML source)?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $ function
I really like the throw error solution, that is great, I want to modify this function because I face even a getElementById bug in the firefox2.0,look at the code: script src=prototype.js/script input type=text value=this should be returned name=test id=www / input type=text value=this should not be returned ff2.0 bug not appeared in ff3.0 a5 name=test id=www / script alert($(www).value) window.setTimeout(function(){alert($(www).value)},1000) /script The code alert($(www).value) in the loading procession has changed the ff2.0's getElementById's behaveor, and with ff3.0 alpha5 this bug won't appeared, so maybe when you face the getELementById's misbehaving the best solution is to use $$(*[id=...]), or just throw a error message and change your html code. For my code: if(!element.id || element.id!=id) { var tmp=[];var y=100; var t=document.getElementById(id); while(t!=null t.id!=id) { var e=t.outerHTML; y++; t.outerHTML=hr id='+y+'; tmp.push([document.getElementById(y),e]); t=document.getElementById(id); } element=t; tmp.each(function(node){ node[0].outerHTML=node[1]; }); } I have some questions, 1.In ie the only way to change a input element's attribute name is to change outerHTML? 2.when I change the one reference element's outerHTML, that reference becomes invalid, I need to get it again, that is why I add var y and y+ +. 3.Is there a regular expression to get out the name attribute from these two strings 'input type=button value=aaa lll name=lll /' and'input type=button value=aaa lll name=lll l /' one name with one without, and the method to modify it. Thanks For the performacnce I think if you just use getELementById and change the bug input's name it would be the fastest, even fast than $$ (*[id='']). On Jun 18, 4:31 am, Adam McCrea [EMAIL PROTECTED] wrote: Oh, if only we all had the luxury to change our sources. ;-) On 6/17/07, Mislav Marohnić [EMAIL PROTECTED] wrote: On 6/17/07, Andrew Dupont [EMAIL PROTECTED] wrote: return $(document.body).down('*[id=foo]'); Nice. But there is an alternative that Tobie suggested: not fixing the issue. if (!element.id || element.id != id) throw Some helpful error message The error would help people learn about this issue and change their sources to avoid it.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] abort()ing the ajax request
Currently, it seems that it's not possible to abort an ajax request. If an already occurring request is aborted, an error is thrown in both firefox and internet explorer (I don't have safari or opera to test with those browsers). In order to be able to abort the request, I rewrote the respondToReadyState function like this: Object.extend(Ajax.Request.prototype, { respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState]; var transport = this.transport, json = this.evalJSON(); var aborted = false; if (state == 'Complete') { try { // raise an exception when transport is abort()ed if (transport.status) 1; } catch (e) { aborted = true; } } if (state == 'Complete' !aborted) { try { this._complete = true; (this.options['on' + this.transport.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(transport, json); } catch (e) { this.dispatchException(e); } var contentType = this.getHeader('Content-type'); if (contentType contentType.strip(). match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction) (transport, json); Ajax.Responders.dispatch('on' + state, this, transport, json); } catch (e) { this.dispatchException(e); } if (state == 'Complete' !aborted) { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } } }); perhaps it would be better if this was included in prototype. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Hijack Browser Loading
You are correct in your assumption of the functionality and unfortunately came to the same conclusion as me in that it can't be done. I do like your idea of setting a cookie maybe once the page is loaded saving wether the browser has JS enabled. Then my server side code could check that cookie on the next page request and serve up all the images if no JS or only the first tab's images if they have JS. The only other option I'm thinking of is wether I could use something like a noscript / block in an image src? Is that valid semantically? mark. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Hijack Browser Loading
Just keep the content to a minimum since ninety-someodd-percent people have javascript enabled. Noted. I'll only be including the image url in the noscript / and using the script to dynamically populate the src. That is if a noscript / is allowed in a `src=` attribute. Otherwise I'll have to place the entire image in a noscript, which can work also. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Hijack Browser Loading
You could try having your Javascript modify the URLs of images that you want to hold off on loading. Unfortunately i've tried this out and it still loads the original images even though the swapped out image is displayed. I realize this is probably a browser specific thing, and may not be possible, but I wanted to pick everyones brains and see if anyone could come up with a creative solution. Thanks! --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Hijack Browser Loading
Here's a prototype I was working on: http://code.markhuot.com/image_trick/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] next(Number) slowdown in Internet Explorer (6,7)
With the latest prototype (1.5.1), the next() function (and probably also prev() and the rest of the navigation function) cause a tremendous slowdown in IE if they are used with the following syntax: next(Number). From what I saw in the code, that translates to a Selector with a '*' expression. Using next(null, 1) solves the slowdown problem. Also, since this might be related, getElementsByClassName is also very slow in this release. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] IE6/7 Freezes from a simple If/Else with Prototype 1.4 1.5
http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/af4c707758c57973/8208e0fe9921b542 I originally posted to see if I was doing something odd that IE didn't agree with. At first I thought it was the hash option, but I'm not sure exactly. I went back to 1.4 and started adding objects piece by piece. The second I added this in 1.4: function $H(object) { var hash = Object.extend({}, object || {}); Object.extend(hash, Enumerable); Object.extend(hash, Hash); return hash; } Is when it started to freeze. Similarly it was right after I added the Hash object in 1.5 that the problem started to occur. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: prototype 1.50_1.51 has a bug on Ajax.Rquest
I have the same problem, I found this page http://michal.maruska.dyndns.org/comp/activity/webwiki/jscript.html with that Warning: (mmc) If IE has no language-preference set, it fails, with error 12150 I think that problem are on non english enviroments, I have installed an Win XP without service pack 1 and 2, the IE version are 6.0.2600, and that's the error, 12150. The error are on Ajax.Request.prototype.setRequestHeaders. There are no information in any page, but I'm working on fix that, some one have a solution??? On Apr 9, 5:44 am, Christophe Porteneuve [EMAIL PROTECTED] wrote: Hi there, I have no issue at all with your being Chinese, however, you certainly understand that posting in English exposes you to the most help, as the vast majority of subscribers to this list will understand English, but probably not Chinese (so far, at least...). We would need you to put together a reproduceable online case somewhere, so we could investigate. Could you also provide us with the following information: - OS version and SP's - Server side details (IIS/ASP? PHP? JSP? RoR?) and versions - Things appear to break on IE6SP1. Does your stuff also work on *other* browsers, e.g. Firefox or Opera? Whether it does or not, tell us which versions you try it with. We need to be able to look at your exact problem context to poke and tweak in order to help you find what's wrong. Sincerely, -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: Curry And Compose
You're right. I was speaking conceptually, I guess, and somewhat vaguely. Let me try again. :-) Technically, there is no question that: f.compose(g) == compose(f,g) which should mean f composed with g, i.e., the function f( g(x) ) The bind / compose example though is compelling exactly because I expect: f.bind(h).compose(g) == f.compose(g).bind(h) which holds true in the current implementation. The reason is that the use case that comes up is that the bind and compose events are typically happening at different points in program execution and you don't want to worry about the order they happen in. A concrete example is maybe useful. Consider the following (from Firebug): sort = Array.prototype.sort sort() split = String.prototype.split.curry(' ') function() split.bind('c b a').compose( sort )() [a, b, c] split.compose( sort ).bind('c b a')() [a, b, c] It's mathematically WRONG, but very handy. Or maybe it's just me? :-) BTW, it is exactly this kind of confusion that lead me down the path of introducing a specific class called Method to handle bringing together the OOP and FP worlds. Since a Method instance is an object (not a closure), you can bind and curry all day and you are still operating on the Method instance. And since I invented it, I don't have to worry about it being mathematically incorrect! :-) Dan On Apr 23, 6:24 am, Ryan Gahl [EMAIL PROTECTED] wrote: I think I am still expecting the bind operation to be applied to the subject of this sentence, that is, function a, not b. I would expect the bind to apply to whatever the result is of the compose (or any other) method, not the object to which the method belongs. In your example you are implying that the result of a.compose(b) is a function, which you are then binding c to. That makes sense, but not what you said. If you wanted c bound to a and then composed with b you'd need a.bind(c).compose(b) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Form not available as singleton.
Hi, The *Form* is not working as a singleton with the svn version of 19-april-2007 9 AM GMT. Example below ilustrates the bug (it is bug right?). Thanks a lot for the great software. Cheers, Zac {{{ html head script src=prototype.js type=text/javascript/script /head body Click any button to reset the form. form id=h onsubmit=return false; input type=text name=hello / br / button onclick=$('h').reset(); /This works/button /form br / button onclick=Form('h').reset();This does not work!/button /body /html }}} ~ ~ ~ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] AJAX Prototype
Dear sir/madam I am very happy to use ajax with free license since Dec 2006. But now I have some problems in using ajax loading PHP page only in IE7 and IE6. The problem (close IE suddenly or show the error diag box) always happen if every page include script language=javascript src=prototype.js/script. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Prototype + Ajax + XML
Hello! I am from Brazil and my English is very poor... hehehehe I have a lot of doubts about using the Prototype.Ajax to get information of a XML. Somebody can help me? I don´t understand if a can get the information of XML using JSON... I am lost!!! Thank´s! Vitor --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: How to try out Class Animal example (Example 4.1) using prototype 1.5?
Ok, thanks. From, Steve --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---