[Proto-Scripty] I need to get what class is creating in initialize method
Is there a way to detect is this is an instance of a Class in initialize method? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: I need to get what class is creating in initialize method
I also need in my class method to have an ability to create ansector class from the current How I could achieve the reference to the class within it mwthod? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] I need to initialize base class an do not bothe user to call $super in subclass
How to setup base class so that subclasses don't neet to call $super in their initialize method (because they might skip this call or call with wrong parameters) ? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: I need to initialize base class an do not bothe user to call $super in subclass
Thanks, it's usefull ! On 3 янв, 16:34, Johan Arensman johanm...@gmail.com wrote: Have you ever considered not including the initialize method in the subclass? Perhaps your baseclass can check if there's a child 'constructor' present and automatically call that: var MySuper = Class.create({ initialize: function() { // do stuff if (this.childConstructor) { this.childConstructor(); } } }); var MySub = Class.create(MySuper, { childConstructor: function() { // stuff that only the child needs to do // MySuper.initialize has already been called at this moment. } }); Ofcourse the naming can be different but it's just an idea. On Tue, Jan 3, 2012 at 3:25 PM, buda www...@pochta.ru wrote: How to setup base class so that subclasses don't neet to call $super in their initialize method (because they might skip this call or call with wrong parameters) ? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Recode jQuery expression in the prototype way
http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/ function _onScroll(e) { var el = e.element(); if (el.scrollTop = (el.scrollHeight - (el.clientHeight + 50))) { if (dataContextLength ! == el.childElements().length) { onDataContextChanged(); } } } On 15 дек, 21:35, Moo stuhlm...@fifty-nine.de wrote: Hi there! I found a very useful script-snippet for endless scrolling. It loads new content via AJAX when the page is near the bottom of the page. My knowledge about JavaScript and Prototype is pretty good actually, but I always had problems with all the measurement stuff. Here's the line of code: var nearBottomOfPage = $(window).scrollTop() $(document).height() - $ (window).height() - 200; How could I get that working with Prototype? Thank you very much! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Recode jQuery expression in the prototype way
http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/ function onScroll(e) { var el = e.element(); if (el.scrollTop = (el.scrollHeight - (el.clientHeight + 50))) { if (dataContextLength !== el.childElements().length) { onDataContextChanged(); } } } -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/fmlKaZxCzMMJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Where is ver. 2.0 is coming?
Who knows when is early code ver.2.0 of the library will appear? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Where is ver. 2.0 is coming?
But it's only new syntax sugar - not framework like Prototype with many features!! On 28 ноя, 18:48, Pablo Aravena paraven...@gmail.com wrote: Hi buda I think there will be no new releases of prototype in the near future. That is sad, but some months ago I began looking at CoffeScript and I began thinking that it will be the natural replace for prototype library. Also many of the original creators of the prototype library are working on that project. See this presentation: https://sstephenson.s3.amazonaws.com/presentations/fowa-2011-coffeesc... Saludos Pablo On Mon, Nov 28, 2011 at 8:30 AM, buda www...@pochta.ru wrote: Who knows when is early code ver.2.0 of the library will appear? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Where is ver. 2.0 is coming?
I'm vary sad - I have to migarte on jQuery ((( On 28 ноя, 21:57, buda www...@pochta.ru wrote: But it's only new syntax sugar - not framework like Prototype with many features!! On 28 ноя, 18:48, Pablo Aravena paraven...@gmail.com wrote: Hi buda I think there will be no new releases of prototype in the near future. That is sad, but some months ago I began looking at CoffeScript and I began thinking that it will be the natural replace for prototype library. Also many of the original creators of the prototype library are working on that project. See this presentation: https://sstephenson.s3.amazonaws.com/presentations/fowa-2011-coffeesc... Saludos Pablo On Mon, Nov 28, 2011 at 8:30 AM, buda www...@pochta.ru wrote: Who knows when is early code ver.2.0 of the library will appear? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Prototype's Event system need to be fixed
1) Since IE9 IE has addEventListener - so it has to listen events in standart W3C way - so it has capture events I use capturing very often - so I forced, instead using on or observe, use addEventListener 2) In the library's code there are planty tones of check - 'if (element.addEventListener)' I believe that they could be replaced by somthing like this: if (element.addEventListener) eventListenerFn = 'addEventListener' else eventListenerFn = 'attachEvent' and than everywhere use - element[eventListenerFn] or somthing else -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
Hi T.J.! Thanks for your help! This code will be sheared and there is the risk that people have an ability involuntarily to change privates - so I need to protect it -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/Xoegt09vOssJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Is it posible multiple Inheritance?
Thanks On 18 окт, 19:43, Andy andreas.schuhmache...@googlemail.com wrote: On 13 Okt., 18:05, buda www...@pochta.ru wrote: I need to create class which is inhereted from enumerable module, sortable class and observable class Is it possible in one operation call? Just use Object.extend() var MyClass = Class.create(); Object.extend(MyClass.prototype, Enumerable); Object.extend(MyClass.prototype, Sortable.prototype); Object.extend(MyClass.prototype, Observable.prototype); Object.extend(MyClass.prototype, { // your methods doSomething: function() ... }); -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Future of Prototyp.js
The rapid development of browser features they caught up and there are fewer and fewer differences between them. A year later, they practically do not remain. IE6 is already innonexistence. So I think that the new version should be completely rewritten, freed from the burden of supporting non-existent differences and older browsers and their versions, to be compact andincorporate only what is necessary for developers. Look at script.aculo.us - its now Scripty2 full rewritten library, compact and modern! If the library becomes of such - it can easily be used on mobile devices will become more widelypopular. And I'll love her even more:) -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/06OSiwQoHFIJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Object.isArray should be changed
I've noticed that library's isArray not worked properly sometimes. I offer new version of it isArray: function(obj) { return (typeof(obj) === 'object') !Object.isUndefined(obj.forEach); } -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/TljCC7hb_QkJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
Hi! Thanks for response. `_items` - it's typo ;) of course there mightbe - return _privates[this. internalId].items.slice(0); I agree with you about error in destroy - not deleting an instance item in _privates array. About not using such pattern - I agree if only few methods need to access _privates, but what if an object has about 10 or more methods that manipulate _privates!? make them all per instance? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/LUtI95pwSwoJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: An idea from jQuery which might be borrowed to Prototype
I've solved - here is working example http://jsfiddle.net/DybH8/19/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/iMik5BYYA7UJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: An idea from jQuery which might be borrowed to Prototype
I've solved - here is working example http://jsfiddle.net/DybH8/21/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/QR-HUdqLIMQJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: An idea from jQuery which might be borrowed to Prototype
I've solved - here is working example http://jsfiddle.net/DybH8/22/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/RxVdUDrLqyAJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Is it posible multiple Inheritance?
Hi Andrew! is it possible to realize extending of the class by in a way that at the end of this process would be called the initialization method of extension? So I would be extend any class with such extensions with no need to create intermediate classes. Often in such extension I need to add some properties to extended object and need to initialiaze them - initialization of extension would be the nice idea! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/7QbiDonWHjkJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] An idea from jQuery which might be borrowed to Prototype
Hi! Working on porting Microsoft DataLink plugin to Prototype i began learn jQuery and found one interesting thing; instead of workin whith JS objects in the way of Object.method(obj) they use wrap this object in so called jQuery object which already has all needed method and propeties to work with the object but keep original object inside untouched. This has a benefit - original object is untouched and we can work wit it like it has everithing we need. And there is the second benefit - the wrap object has internal id !!! - so it can use storage like DOM element in Prototype.js but I cannot! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/_b9eM-7YaPcJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/13/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/l9kqGcChnY0J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/16/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/XUJjM-_lfB0J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: An idea from jQuery which might be borrowed to Prototype
So, I need the idea to have an ability to any object use the storage var a = { name: 'John', last: 'Pupkin' } add to 'a' an 'id' field - corrupt 'a' as object so I need a way to identify a to have an ability to use the storage Any idea? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3dTmVHl-u7gJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
T.J. here is the example of using instange private vaiables store in use - http://jsfiddle.net/QW8vM/17/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/Zfa-oe-dQvEJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
T.J. here is the example of using instance private vaiables store in use - http://jsfiddle.net/QW8vM/17/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/VMcUCBbyjToJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
it's general example for show the problem with Object.clone :) Usually I use anothe technique: var a = Class.create((function(){. var instancePrivates = []; function initialize(){ var internalId; instancePrivates.push({}); internalId = --instancePrivates; instancePrivates[internalId].items = [] --- here instance private items !!! :) -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/4fipXTWMndwJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
in last example of course this.internalId = --instancePrivates; instead of var internalId; internalId = --instancePrivates; -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/Kn_ZZp4sFXcJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
that sample was to demonstarte Object.clone bug :) Usually I us to var a = Class.create((function() { var _privates = []; function initialize() { _privates.push({}); this.internalId = _privates.length-1; _privates[this.internalId].items = []; -- here the instances items ... -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/vl61KSkPtYIJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why created object is not extended with Object methods?
T.J. what the reasons not to make them Object.prtototype methods? On 18 окт, 14:21, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 18, 8:30 am, buda www...@pochta.ru wrote: I try var o = {}; o.name = 'propertyName'; alert(o.keys); -- undefined why? but in debugger I see that Object has all methods, but o - not! `keys` is not an instance method, it's a method of the `Object` function: alert(Object.keys(o)); // name You're confusing `Object` with `Object.prototype`. The properties of `Object` are not inherited by object instances; the properties of `Object.prototype` are. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
I use destroy method on the class and clean everythig in it On 18 окт, 14:17, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 18, 10:29 am, buda www...@pochta.ru wrote: that sample was to demonstarte Object.clone bug :) It's not a bug, though I'd say detecting that it's being fed an array wouldn't be a bad feature to add. Usually I us to var a = Class.create((function() { var _privates = []; function initialize() { _privates.push({}); this.internalId = _privates.length-1; _privates[this.internalId].items = []; -- here the instances items ... How do you ever clean up the private data for instances that have been released and reclaimed by the GC? Some kind of destroy contract and hope you don't miss out a destroy call? -- T.J. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
it's ok T.J. - I'll try to write a test on JS Bin and write link here to reproduce the bug On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code that's a bit more cleaned up, wasn't meant as a dig. -- T.J. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
Here is a sample from my code http://jsfiddle.net/QW8vM/9/ On 17 окт, 12:33, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 17, 10:17 am, T.J. Crowder t...@crowdersoftware.com wrote: It's very hard to help when the code presented is fundamentally broken and yet reported as working. Sorry, in print that comes across much more harshly than it was intended to. I only mean that it's easier to help debug code that's a bit more cleaned up, wasn't meant as a dig. -- T.J. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
sorry - this is a write link http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3QhVzBt2bpUJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: strange problem with detect method and cloning data
here the code http://jsfiddle.net/QW8vM/10/ -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/NzCfXch19G8J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] strange problem with detect method and cloning data
I have a class var a = Class.Create({ function initialize() { var _items = []; Object.defineProperties(this, { 'items': { get: function () { return Object.clone(_items); }, enumerable: true } }); ... } function indexOf(item) { return -1; } }); then I create an instance of the class var b = new a(); then I fill the _items with the data [ { name: 'Joe', last: 'Celko' }, { name: 'Ivan', last: 'Susanin' } ] and ovewrite the indexOf method with thw new one b.indexOf = function(item) { var index = -1; var items = this.items; items.detect(function(el, idx) { var b = (el.name === item.name) (el.last === item.last); b (index = idx); return b; }); return index; }; then i try to seach b.indexOf({ name: 'Joe', last: 'Celko' }); and always get -1 !!! I try to debug and detect the this._each in Enumerable.each never goes into, but if I chnge return Object.clone(_items); --- return _items; everything goes ok and returns 0! Why? Help me please. I cannot expose original items because changes on it maybe damaged -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Is there realization of deferred object on prototype.js?
Many frameworks have such object. Is there any realization of it? Will it be implemented in future releases? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Is it posible multiple Inheritance?
I need to create class which is inhereted from enumerable module, sortable class and observable class Is it possible in one operation call? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Extending Templates functionality
How to extend Templates to add myself selectors and command Like Microsoft jQuery Template, to support operations not only on one object but on a list subobjects and so on? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] And why not rename the Template for $ T?
This reduction in short and not yet occupied. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Be sure to buy a book Protorype.js and Sript.aculo.us you fall off 90% of questions.
Since I bought it - it became my reference book, not only on Prototype.js but on JavaScript. I periodically reread it each time discovering new nuances. The more I read it - the more I fall in love with Prototype.js. What an elegant architectural solutions! What is non-trivial syntax! JQuery, compared with Prototype.js - technical Library. Prototype.js is - the art of programming! Everyone must have this book. You will become better understood not only the work of the library, and JavaScript in general. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Future of Prototype.js
I also nee optional parameter in 'observe' and 'on' methods to capture events On 23 сен, 21:27, buda www...@pochta.ru wrote: Thanks for the detailed post. I myself have been using Prototype.js from the very beginning and its ideology is close to me. I'm anxious for the fate of the library - and therefore raised the question I would be pleased to help the project. but I do not know what and how - the money that I earn in Ukraine, so small that they are not enough for life to say nothing of assistance to the project:) The only thing I could - to write what I feel right now must be changed in the library. For example: - would love to be able to collect a library, pointing out the necessary functionality - be able to drop support for older browsers and crossbrowsing (modern browser now have the same functionality) Ready with pleasure to help develop the project - tell me how. On 23 ÓÅÎ, 20:34, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I should have said: If you do decide to switch, beware that jQuery only covers about 3/4ths of the ground Prototype covers. It does all the DOM stuff, but doesn't do much of anything in terms of language enhancement. So no equivalent to `Class`, for example, nor any of the added methods on `Array`, `String`, or `Function`. (It does have a subset of those on offer, just not as extensions to the built-ins -- for instance, `jQuery.trim` rather than `String#strip`, `jQuery.proxy` rather than `Function#bind`). If you need a `Class`-like thing, I did one you might look at:http://blog.niftysnippets.org/2009/09/simple-efficient-supercalls-in My main point being: jQuery is great, but its scope isn't as broad. In some ways that may be what you want with this ECMAScript5 stuff coming in -- or not. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Sep 23, 5:19špm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, This was _JUST_ gone into, in depth:http://groups.google.com/group/prototype-scriptaculous/browse_thread/... I think this is a fair-ish (but incomplete) summary: 1. Prototype is a spare-time activity for a very small number of people. In fact, at the moment I think it's mostly just Andrew, and he has other things he does (like, you know, hold down a full-time job). Just recently the project largely lost another major contributor to his job and family commitments. 2. Andrew has no plans to stop working on Prototype on any time soon. 3. Prototype work is done in fits and spurts, long periods of inactivity followed by a period (couple of weeks) of feverish activity. 4. jQuery has multiple corporate sponsors, not least Microsoft, and there are people paid to work on it full time. Thus it's able to be much more up-to-date and proactive than Prototype. A quote from Andrew in the thread linked above: On Aug 23, 1:07šam, Andrew Dupont googlegro...@andrewdupont.net wrote: I will say, though, that if we're crowning winners and losers, then jQuery won a long time ago. It is certainly the _de facto_ JavaScript library for web development. The good news is that the losers of the war aren't looking so bad; libraries like Prototype, MooTools, and Dojo still have loyal user bases, and I doubt they're going away. My personal perspective, for what it's worth (e.g., possibly exactly what you're paying for it, nothing :-) ) is based on some data points: 1. The last blog post on the Prototype blog was 10 months ago. 2. The library has had basically no activity since v1.7 was released November 2010. 3. The most recent three releases were: š šv1.7 - November 2010 š šv1.6.1 - September 2009 š šv1.6.0.3 - September 2008 Three releases, in total, including dot releases, in the last three years. Compare with 16 releases (four major ones) of jQuery in that time period (v1.3 through v1.6.4). 4. Absolute use and trends: Absolute use:http://trends.builtwith.com/javascript Prototype trend:http://trends.builtwith.com/javascript/Prototype jQuery trend:http://trends.builtwith.com/javascript/JQuery 5. Questions tagged on StackOverflow: jQuery: š š114,842 Prototype: š 2,152 ...which could, of course, just mean that Prototype is so much better it generates fewer questions, or that people using Prototype don't use StackOverflow, or that people are mis-tagging JavaScript questions jquery (I see that a fair bit), or some combination of those. Does all this mean Prototype is dead? No, not a bit of it. But it has a very small staff with other major demands on their time, and has no funding. Andrew's quite clear that it's not dead, and also that it will continue in much the way it has these last three years. I made the business, not technical, decision years ago to use jQuery rather than Prototype
[Proto-Scripty] Future of Prototype.js
It has long heard nothing about plans for the future. Browsers are evolving, and many library functions are duplicate the functions of JavaScript. Already implemented in all browsers support ECMAScript 5, but the library is not reflected. I would like to be able to not pull in hundreds of kilobytes to support older browsers and have only the functionality you need - as it is implemented in other libraries like JQuery. What is the future of Prototype.js? Is it live or dead? Should I start to learn JQuery? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Future of Prototype.js
questions, but for me the business case is: Which library amongst the large number out there is kept up-to- date; jumps on testing new browser versions for compatibility; has a large ecosystem of code I can use; has a large pool of talent I can hire or contract; has well-maintained, frequently updated and extended, reliable, and documented UI helpers (jQueryUI vs. Script.aculo.us); and is likely to be around long-term without heroic effort from a single individual, or a small set of individuals. So I went with jQuery, despite preferring Prototype in many ways. [I also looked at Dojo, ExtJS, (more recently) Closure, and a few others.] It could have gone another way. People like me could have done more to contribute to the project; leadership could have focussed on core functionality, community-building, and developer (um) development rather than side-issues; corporate sponsorship could have been courted and perhaps ultimately found. But that didn't happen, and it didn't happen because the Prototype community and leadership didn't make it happen (perhaps corporate sponsorship wasn't desirable; fair 'nuff) and because luck didn't go Prototype's way. (And don't think luck isn't a big factor here.) I have nothing but respect and admiration for Andrew and everyone else who has made Prototype what it is. And there's absolutely no reason not to use it on your websites if you test with your target browsers and it does what you need it to do. Again, Andrew is clear he'll keep going with it, and I'm sure he'd be very happy to have help from anyone reading this. So does Prototype have a future? Yes. What kind of future depends a lot on the people reading this note. If you all, like me, don't have time to contribute and Andrew has to largely work on his own, that's one kind of future. If you can make time to help, get your companies to let you help a bit during paid time, that sort of thing, then it will have a different kind of future. I hope all these recent questions about Prototype's future mark the beginning of a renaissance for the library, a turning point of talent looking to help out. I wish I could be part of it. Best, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Sep 23, 12:34 pm, buda www...@pochta.ru wrote: It has long heard nothing about plans for the future. Browsers are evolving, and many library functions are duplicate the functions of JavaScript. Already implemented in all browsers support ECMAScript 5, but the library is not reflected. I would like to be able to not pull in hundreds of kilobytes to support older browsers and have only the functionality you need - as it is implemented in other libraries like JQuery. What is the future of Prototype.js? Is it live or dead? Should I start to learn JQuery? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Will Ajax support ontimeot event on XMLHttpRequest in IE8?
IE8 supports an even ontimeout on XMLHttpRequest How can I manually add support To Ajax object not waiting new version of prototype.js? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Memory leak in Prototype 1.7
Thanks! On 14 июн, 12:31, KIR kirill.maxi...@gmail.com wrote: On Jun 14, 7:08 am, buda www...@pochta.ru wrote: How do you find memory leak in Chrome? I acnt find any tool except memory graph! Using a memory profiler. Create a memory dump (there is an icon with eye), do actions which shouldn't retain new DOM elements, create second memory dump. Chrome shows a difference between memory dumps (in terms of memory size and object counts). Regards, KIR On 13 июн, 18:02, KIR kirill.maxi...@gmail.com wrote: Hello, I've found (and fixed) a memory leak in Prototype 1.7. Some details are here: http://kirblog.idetalk.com/2011/06/prototype-17-memory-leak.html Would be glad if you find this useful. Regards, KIR -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Starnge order of observing of events dom:loaded in IE8
I've registered on a page scripts html body . body script src=prototype.js type=\text/javascript\script script src=global.js type=\text/javascript\script script src=page1.js type=\text/javascript\script /html in global.js I've registered an event observer on event dom:loaded document.observe('dom:loaded', function(){ ... }); which makes global preparations and in page1.js I also add an observer on the same event - to do page int In IE9 order of execution of event observer right - first in global.js and the second in page1.js But in IE8 the order wrong - first page1.js and then global.js Help me please what to do! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Starnge order of observing of events dom:loaded in IE8
I'm sad - I've added scripts at the header, but without the rezult ( On 15 июн, 01:01, buda www...@pochta.ru wrote: there were typing mistakes This is shoud be typed like this script src=prototype.js type=text/javascriptscript script src=global.js type=text/javascriptscript script src=page1.js type=text/javascriptscript May be the order is differen because I add scripts at the bottom of the body??? On 15 июн, 00:58, buda www...@pochta.ru wrote: I've registered on a page scripts html body . body script src=prototype.js type=\text/javascript\script script src=global.js type=\text/javascript\script script src=page1.js type=\text/javascript\script /html in global.js I've registered an event observer on event dom:loaded document.observe('dom:loaded', function(){ ... }); which makes global preparations and in page1.js I also add an observer on the same event - to do page int In IE9 order of execution of event observer right - first in global.js and the second in page1.js But in IE8 the order wrong - first page1.js and then global.js Help me please what to do! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Memory leak in Prototype 1.7
How do you find memory leak in Chrome? I acnt find any tool except memory graph! On 13 июн, 18:02, KIR kirill.maxi...@gmail.com wrote: Hello, I've found (and fixed) a memory leak in Prototype 1.7. Some details are here: http://kirblog.idetalk.com/2011/06/prototype-17-memory-leak.html Would be glad if you find this useful. Regards, KIR -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] DOM tree modification event in prototype.js
JQuery has such event Could I have the same functioanility if I wrap all DOM-modifies method with firing such event after modification and if I use the only this methods to modify DOM? Is it right way? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] The method of the temporary opening and closing access to the private variable.
I've found an article in russian A modular approach to JavaScript. (http://habrahabr.ru/blogs/javascript/117069/) where the autor explains one interesting idea how temporary to open/ close acces to private variable. This trick is based on that if private variable is not simple tipy - it may be accessible through a reference outside the private scope var MODULE = (function (my) { var _private = my._private = my._private || {}, _seal = my._seal = my._seal || function () { delete my._private; delete my._seal; delete my._unseal; }, _unseal = my._unseal = my._unseal || function () { my._private = _private; my._seal = _seal; my._unseal = _unseal; }; // permanent access to _private, _seal, and _unseal return my; }(MODULE || {})); It's useful when MODULE is broken down into files. To give an acces to part of MODULE in anothe file: MODULE._unseal(); do somthing with MODULE._private (e.g. with _private) MODULE._seal(); It's very interesting! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Prototype.js: is it possible to extend Object with module which is not the reference?
I use to extend class with static members but in a resul I extend clsses every time with the same module - but I neet the very time the new copy of it I need that every class could trace theirs instances var module = (function(){ var instances = [], pubs = {}; pubs.addInstance = addInstance; function addInstance(inst){ instances.push(inst); } pubs.removeInstance = removeInstance; function removeInstance(inst){ instances = $A(instances).without(inst); } function getInstances() {return $A(instances); } }()); var Class1 = Class.create({...}), Class2 = Class.create({...}); Object.extend(Class1, module); Object.extend(Class2, module)l var c1 = new Class1, c2 = new Class2; after creating c1 and c2 in Firebug we could see that every object references the same module, so Class1 and Class2 have instances array with two elements - but I need to have one If I extend every Class not with module but with explicity defined block - everythig works fine? but it's require typing the same every time! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Prototype.js: is it possible to extend Object with module which is not the reference?
I missed to write at the end of module definition write string: return pubs; On 28 май, 20:09, buda www...@pochta.ru wrote: I use to extend class with static members but in a resul I extend clsses every time with the same module - but I neet the very time the new copy of it I need that every class could trace theirs instances var module = (function(){ var instances = [], pubs = {}; pubs.addInstance = addInstance; function addInstance(inst){ instances.push(inst); } pubs.removeInstance = removeInstance; function removeInstance(inst){ instances = $A(instances).without(inst); } function getInstances() {return $A(instances); } }()); var Class1 = Class.create({...}), Class2 = Class.create({...}); Object.extend(Class1, module); Object.extend(Class2, module)l var c1 = new Class1, c2 = new Class2; after creating c1 and c2 in Firebug we could see that every object references the same module, so Class1 and Class2 have instances array with two elements - but I need to have one If I extend every Class not with module but with explicity defined block - everythig works fine? but it's require typing the same every time! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Prototype.js: is it possible to extend Object with module which is not the reference?
I'm sorry - I've found the solution: function extendWithInstances(theClass){ Object.exctend(theClass, function(){ var instances = [], pubs = {}; .. }()); } .. extendWithInstances(Class1); extendWithInstances(Class2); On 28 май, 20:11, buda www...@pochta.ru wrote: I missed to write at the end of module definition write string: return pubs; On 28 май, 20:09, buda www...@pochta.ru wrote: I use to extend class with static members but in a resul I extend clsses every time with the same module - but I neet the very time the new copy of it I need that every class could trace theirs instances var module = (function(){ var instances = [], pubs = {}; pubs.addInstance = addInstance; function addInstance(inst){ instances.push(inst); } pubs.removeInstance = removeInstance; function removeInstance(inst){ instances = $A(instances).without(inst); } function getInstances() {return $A(instances); } }()); var Class1 = Class.create({...}), Class2 = Class.create({...}); Object.extend(Class1, module); Object.extend(Class2, module)l var c1 = new Class1, c2 = new Class2; after creating c1 and c2 in Firebug we could see that every object references the same module, so Class1 and Class2 have instances array with two elements - but I need to have one If I extend every Class not with module but with explicity defined block - everythig works fine? but it's require typing the same every time! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Class with private members pattern
Here is an example http://jsbin.com/eyapo3/2/edit On 26 май, 23:27, buda www...@pochta.ru wrote: One thing is stay for me unconvinient is calling private functions in public functions. It's nessety to call them with .bind(this)(...) function publicFunc1(){ ... _private_prop1 = 45; _privateFunc1.bind(this)(); ... } May be you have suggestion on this -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Class with private members pattern
Thanks! your articles are very useful! On 27 май, 12:43, T.J. Crowder t...@crowdersoftware.com wrote: Hi, One thing is stay for me unconvinient is calling private functions in public functions. It's nessety to call them with .bind(this)(...) No, that's a very inefficient way to call them. Instead: _privateFunction.call(this, arg1, arg2); or _privateFunction.apply(this, array_of_args); Function#call and Function#apply are part of JavaScript. More about them in the spec[1], of course, and on MDC[2][3]. More about various approaches to private methods here[4] and (somewhat indirectly) here[5]. [1]http://www.ecma-international.org/publications/standards/Ecma-262.htm [2]https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/... [3]https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/... [4]http://blog.niftysnippets.org/2009/09/private-methods-in-javascript.html [5]http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On May 26, 9:27 pm, buda www...@pochta.ru wrote: One thing is stay for me unconvinient is calling private functions in public functions. It's nessety to call them with .bind(this)(...) function publicFunc1(){ ... _private_prop1 = 45; _privateFunc1.bind(this)(); ... } May be you have suggestion on this -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Is there a way to autoinherited static member from superclass
I use to do var Class1 = Class.create({ ... }); Object.extend(Class1, { staticProp: '', staticMeth: function(){...} }) var Class2 = Class.create(Class1, { }); Object.extend(Class2, { staticProp: '', staticMeth: function(){...} }) Is there a way to inheritate staticProp and staticMeth in inherited classes automatically? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Is there a way to autoinherited static member from superclass
T.J. could you provide what do you mean in scheme code, please Thanks On 27 май, 15:43, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Is there a way to inheritate staticProp and staticMeth in inherited classes automatically? Not built into `Class.create`, no. You could readily create a wrapper for it that did that, though, looping through the own properties on the superclass passed in and applying them to the resulting subclass function. Important to be sure to skip over some that shouldn't be copied, like -- to pick an example at random -- `prototype` (though I don't think `prototype` is an enumerable property anyway, so it shouldn't show up on a `for..in` loop). But there will be some to skip, not least the ones Prototype puts on it like `addMethods`, `superclass`, etc. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On May 27, 1:25 pm, buda www...@pochta.ru wrote: I use to do var Class1 = Class.create({ ... }); Object.extend(Class1, { staticProp: '', staticMeth: function(){...} }) var Class2 = Class.create(Class1, { }); Object.extend(Class2, { staticProp: '', staticMeth: function(){...} }) Is there a way to inheritate staticProp and staticMeth in inherited classes automatically? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Class with private members pattern
After reading a good book I found for myself a mthod to have private members in Class Here is the pattern var myClass = Class.create((function(){ var _private_prop1, _private_prop2, public_prop; function _privateFunc1(){ ... } function _privateFunc2(){ ... } function publicFunc1(){ ... } function publicFunc2(){ ... } return{ public_prop: public_prop, publicFunc1: publicFunc1, publicFunc2: publicFunc2 }; }())); -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Class with private members pattern
One thing is stay for me unconvinient is calling private functions in public functions. It's nessety to call them with .bind(this)(...) function publicFunc1(){ ... _private_prop1 = 45; _privateFunc1.bind(this)(); ... } May be you have suggestion on this -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Class.create and prototype and instance methods
Why Class.create produces only instance methods but not prototype ones? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Class.create and prototype and instance methods
static - means defined in object's prototype? but what difference between foo, which decleared in prototype, and so called static method bar? which is also decleared in prototype? On 24 май, 16:55, T.J. Crowder t...@crowdersoftware.com wrote: On May 24, 2:39 pm, buda www...@pochta.ru wrote: Why Class.create produces only instance methods but not prototype ones? `Class.create` *does* create methods on the prototype: var C = Class.create({ foo: function() { } }); display(typeof C.prototype.foo == + typeof C.prototype.foo); // typeof C.prototype.foo == function Live copy:http://jsbin.com/ajifi5 Do you mean static methods? E.g., C.methodName? `Class.create` doesn't do them, but they're easy to add either directly or via `Object.extend`: Object.extend(C, { bar: function() { } }); display(typeof C.bar == + typeof C.bar); // typeof C.bar == function Live example:http://jsbin.com/ajifi5/2 (Side note: I'm using anonymous functions above, which I don't actually like very much.[1] But I didn't want to introduce scoping functions and such.) [1]http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Is there a plan to add video module to script.aculo.us?
HTML5 supports video and there is a need to have support for it like a sound module -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] will be in prototype function queue mechanism like deffered objects in jQuery?
Now its an actual task to manage some async calls and do somthing after executing some calls and so on... -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Dilemma: singleton or ordinal object?
why do not you like the anonymous function? On 25 дек, 00:42, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I'm sorry to say that I really can't tell what you're asking. I mean, singletons in JavaScript are dead easy because objects are just objects: var Singleton = { foo: function() { // ... }, bar: function() { // ... } }; Or if (like me) you don't like anonymous functions: var Singleton = (function(){ var pubs = {}; pubs.foo = Singleton_foo; function Singleton_foo() { // ... } pubs.bar = Singleton_bar; function Singleton_bar() { // ... } return pubs; })(); Usage: Singleton.foo(...); Singleton.bar(...); ...but somehow I don't think that's what you have in mind. FWIW (little, I'm thinking), -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 24, 2:01 am, buda www...@pochta.ru wrote: Usually we have some fields in a form like date-field. I have a dilemma: in such languages as C# I would create singleton and use one class per many date-fields to display calendar. I dont know is it possible (how to create singleton class and how create ordinary class with static methods and fields) and expediently to make singleton calendar class or have on ordinary calendar object per date-field? Help me please -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Dilemma: singleton or ordinal object?
Thanks, very interesting article! http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html On 26 дек, 00:59, T.J. Crowder t...@crowdersoftware.com wrote: why do not you like the anonymous function? Because I like to help my tools help me:http://blog.niftysnippets.org/2010/03/anonymouses-anonymous.html -- T.J. :-) On Dec 25, 8:26 pm, buda www...@pochta.ru wrote: why do not you like the anonymous function? On 25 дек, 00:42, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I'm sorry to say that I really can't tell what you're asking. I mean, singletons in JavaScript are dead easy because objects are just objects: var Singleton = { foo: function() { // ... }, bar: function() { // ... } }; Or if (like me) you don't like anonymous functions: var Singleton = (function(){ var pubs = {}; pubs.foo = Singleton_foo; function Singleton_foo() { // ... } pubs.bar = Singleton_bar; function Singleton_bar() { // ... } return pubs; })(); Usage: Singleton.foo(...); Singleton.bar(...); ...but somehow I don't think that's what you have in mind. FWIW (little, I'm thinking), -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Dec 24, 2:01 am, buda www...@pochta.ru wrote: Usually we have some fields in a form like date-field. I have a dilemma: in such languages as C# I would create singleton and use one class per many date-fields to display calendar. I dont know is it possible (how to create singleton class and how create ordinary class with static methods and fields) and expediently to make singleton calendar class or have on ordinary calendar object per date-field? Help me please -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Dilemma: singleton or ordinal object?
Usually we have some fields in a form like date-field. I have a dilemma: in such languages as C# I would create singleton and use one class per many date-fields to display calendar. I dont know is it possible (how to create singleton class and how create ordinary class with static methods and fields) and expediently to make singleton calendar class or have on ordinary calendar object per date-field? Help me please -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Do somthing only after two Ajax calls return results
Thanks! This is what I need On 22 ноя, 12:15, T.J. Crowder t...@crowdersoftware.com wrote: I have two calls run asyncronously Two - is an example - they may be N-calls :) I'd recommend avoiding that unless the async calls are to *different* servers, and if you do two at once, certainly never do more than two at once. Run just a single async request at a time, two if you absolutely have to, and chain them using the `success` handler. Why? Because browsers (and some servers) clamp down the number of connections to a given server at the same time. Mostly, with modern desktop browsers, you can expect the browser will allow four[1] (up from the previous figure of two), but IE will drop down to only allowing two if it detects a dial-up connection and you don't know what the next dot rev of any browser may do. Also, mobile browsers have lower limits. In terms of mechanism, I'd probably have a pending count (no need for global variables): * * * * // Start the requests defined in the array `requests`, call `callback` // when they've all finished. function sendMultipleRequests(requests, callback) { var req, pending; // Prep and start each request. We assume the objects have a `url` // property and a `params` property. pending = 0; while (pending requests.length) { // Get this request req = requests[pending]; // Hook into the onComplete, respecting the previous one if any req.params = req.params || {}; req.params.onComplete = req.params.onComplete ? req.params.onComplete.wrap(reqComplete) : reqComplete; // Start and count this request new Ajax.Request(req.url, req.params); ++pending; } function reqComplete() { --pending; if (pending = 0) { // All done, call the callback. // Note that there's no race condition with the loop above (e.g., // there's no possibility we'll be called and decrement `pending` // to 0 while the loop above is still incrementing it) because // JavaScript on browsers is single-threaded unless you explicitly // use the web workers stuff, which we aren't. callback(); } } } [1]http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-conne... HTH, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Nov 21, 8:40 pm, buda www...@pochta.ru wrote: I have two calls run asyncronously I need to wait when they both is comleted and only then do somthing Two - is an example - they may be N-calls :) What is the right method to do it? Is theere an object somthing AsyncWaitFor(AjaxCall1...AjaxCallN)? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Do somthing only after two Ajax calls return results
This is not sutable because inparallel maybe run othes async calls which I dont need wait to complete On 22 ноя, 18:04, Brian Marquis br...@quotepro.com wrote: Forgot to unregister the responder. See revised watcher: var watcher = { start: function() { Ajax.Responders.register(responder); }, stop: function() { Ajax.Responders.unregister(responder); }, responder: { onComplete: function() { if ( Ajax.activeRequestCount == 0 ) { finalize(); } } } }; From: prototype-scriptaculous@googlegroups.com [mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Brian Marquis Sent: Monday, November 22, 2010 9:43 AM To: prototype-scriptaculous@googlegroups.com Subject: RE: [Proto-Scripty] Do somthing only after two Ajax calls return results var watcher = { watching: false, start: function() { watching = true; Ajax.Responders.register({ onComplete: function() { if ( watching Ajax.activeRequestCount == 0 ) { finalize(); } } }); stop: function() { watching = false; } }; // start your requests, then watcher.start(); function finalize() { watcher.stop(); // do other stuff } From: prototype-scriptaculous@googlegroups.com [mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of Daff Niles Sent: Sunday, November 21, 2010 8:10 PM To: prototype-scriptaculous@googlegroups.com Subject: Re: [Proto-Scripty] Do somthing only after two Ajax calls return results Hi Buda, Having had this issue, and seen other frameworks sorting this out, the quickest and easiest way I have found is to have to global variables (flags) in the page, one for each of the Ajax calls. The Ajax callback method for each then sets the flag for that call back, then checks if both flags have been set, and if so, calls the function of your choice that will then continue the processing you desire. Because each callback only sets its own flag, but then checks both, it will not matter which order they callbacks are received and processed. pseudo code (untested) var flag_1 = false; var flag_2 = false; function callback_function_1() { // Processing... flag_1 = true; if(flag_1 flag_2) { // Call final method... finalize() } } function callback_function_2() { // Processing... flag_2 = true; if(flag_1 flag_2) { // Call final method... finalize() } } function finalize () { // Complete processing here... // If we need to call again, then reset the two flags in here... } Hope that helps. Regards. daff SOFTWARE ENGINEER andrew 'daff' niles | spidertracks | 117a the square po box 5203 | palmerston north 4441 | new zealand P: +64 6 353 3395 | M: +64 21 51 55 48 E: d...@spidertracks.co.nz www.spidertracks.com http://www.spidertracks.com/ On 22/11/2010, at 9:40 AM, buda wrote: I have two calls run asyncronously I need to wait when they both is comleted and only then do somthing Two - is an example - they may be N-calls :) What is the right method to do it? Is theere an object somthing AsyncWaitFor(AjaxCall1...AjaxCallN)? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http
[Proto-Scripty] Do somthing only after two Ajax calls return results
I have two calls run asyncronously I need to wait when they both is comleted and only then do somthing Two - is an example - they may be N-calls :) What is the right method to do it? Is theere an object somthing AsyncWaitFor(AjaxCall1...AjaxCallN)? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: How should I model this if extending the DOM is bad?
Keep reference to the object in storage of a paragraph, video and etc On 4 ноя, 23:09, Luke kickingje...@gmail.com wrote: Hi, sorry for the non-descriptive topic, I couldn't think of anything better. However, I'm currently working on a project where you can create simple webpages by adding different types of paragraphs, (eg. Text, Image, Video) one below the other, and edit their contents, move or delete them. Basically like this: http://blogage.de/files/60901/image Im rewriting the JS and I have a little problem here; I recently read that extending the DOM is basically a bad idea and that in Prototype 2 they will even stop that practice. Now my idea (actually) was, for a project like this, to create classes for each paragraph-type with methods and properties that I would extend the paragraph-DOM with. I mean that if I had, like in the above image, three paragraphs, each would be represented by a DIV with the class=paragraph text or class=paragraph video etc. On the JS-side there would be classes like Text or Video which would have a method that would extend those DIVs with functions and properties necessary to edit, move or delete that paragraph. When, for example, the user clicks on an editlink, it simply would call its paragraph's edit-method. Everything would be nice and clean. But now I know, extending is bad. So I'm kinda stuck here, I don't know how to write unobtrusive JS without writing terrible spaghetti- esque code with lots of observers. I mean I could still organize parts of the code in classes, but there would be a long list of observers (eg. for clicking an edit-link) with switch-cases for the types of paragraphs. Actually even with extending the DOM I'm not totally sure how I would catch the edit-clicking event. As I said, I'm kind of stuck :). Can you help me with ideas? How would you do this? Thanks a lot, Luke -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] bug in 1.7_rc3 Event.isLeftClick in IE8?
in dblckick observer i try to detect which button was clicked in debugger I can see that event.button = 0 but prototype steps in if (IE_LEGACY_EVENT_SYSTEM) branch is this a bug? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: bug in 1.7_rc3 Event.isLeftClick in IE8?
so in IE8 this code also does not work - alert is not appearing when clickin with left button On 7 ноя, 00:06, buda www...@pochta.ru wrote: but I started this because of in Mozilla dblclick fires on right button dblclick but I dont want to execute code if not Event.isLeftClick document.on('dblclick', function (e) { if (!e.isLeftClick()) { return; } alert('Hi'); }); in Mozilla this code doesnt work - I do dblclick with right button and alert is appearing - so I started debugging in IE :) On 6 ноя, 23:15, buda www...@pochta.ru wrote: in dblckick observer i try to detect which button was clicked in debugger I can see that event.button = 0 but prototype steps in if (IE_LEGACY_EVENT_SYSTEM) branch is this a bug? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Will there be a book on the new version and when?
Will there be a book on the new version and when? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Expando or data- like attributes?
Thanks T.J. Now everything became clear. On 20 окт, 16:15, T.J. Crowder t...@crowdersoftware.com wrote: Hi, But, as I understud, expando properties == custom attributes No, properties and attributes are very different things, as I said. You have to be cautious when using expandos, and if you're using Prototype there's not much reason to (use the storage stuff instead), but they're not bad per se. ...but I see expando on extended elements in prototype! Prototype's use of expandos is mostly reasonably cautious. (Could be more so, but...) For instance, all non-API expandos start with an underscore, which means they are very unlikely to conflict with official properties in the future. (For example, when you use `makePositioned` on an element, there's an expando set on the element instance called `_madePositioned`. It's very unlikely that there will be an official or browser-specific property called `_madePositioned` in the future that will conflict with Prototype's expando.) And I'm reasonably certain they never use an expando to refer to another DOM element or to a JavaScript object that, in turn, refers to another DOM object. I said non-API expandos because, of course, all of the stuff Prototype adds to element instances (`addClassName`, `up`, `down`, `select`, etc.) are expandos. On browsers that allow it, they're added to the element prototype, but on IE (and theoretically other browsers that don't allow it), they're straight expandos added when the element instance is extended. And sure enough, that's been a problem at times in the past, when there was some browser-specific extension that conflicted with a name that Prototype was trying to use for something else. (I don't have a specific example, seem to recall some problem using `Element#select` on certain elements in Safari or something.) I understand a future version of Prototype will switch to using element wrappers rather than directly extending the elements (I'm guessing it'll be 2.0, that's a big enough change to justify bumping the major rev.) In your question you said you wanted to be able to use the things you're setting on the element in a selector: $$('p[myAttr=foo]') ...and so in your case, you'll need to use a custom attribute. The best way to use a custom attribute is to use the data- prefix: p data-myAttr=foo.../p $$('p[data-myAttr=foo]') If you also have cases where you don't need it as an attribute, either use an expando *cautiously* or -- and this is probably better -- use the storage system (`Element#getStroage`) that Prototype provides. HTH, -- T.J. Will this to migrate to storage functionality or its not so bad practice? On Oct 20, 1:48špm, buda www...@pochta.ru wrote: T.J., šthanks for an exhaustive explanation! But, as I understud, expando properties == custom attributes and its not good, but I see expando on extended elements in prototype! Will this to migrate to storage functionality or its not so bad practice? On 20 ÏËÔ, 12:51, T.J. Crowder t...@crowdersoftware.com wrote: Hi, maybe I'm confusing javascript properties to the attributes? Yes, I think you are. Easy enough to do, but they're really quite distinct things. HTML elements have attributes, which (initially) come from the markup and are accessible via the DOM methods `getAttribute` and `setAttribute` (Prototype provides `readAttribute` and `writeAttribute` that you should use instead, as they fix lots of oddities -- particularly in IE -- related to certain attributes.) Attributes are not properties. JavaScript objects have properties. The objects browsers provide to JavaScript to represent the DOM are sufficiently like JavaScript objects that they also have properties. (This needn't necessarily have been the case, host-provided objects can follow just about any rules they want, but in practice -- fortunately -- even IE made it possible for the objects themselves to have JavaScript-like properties.) Some attributes are _reflected_ as properties. The classic example is the class attribute, which is reflected by the `className` property. Setting the attribute changes the property; setting the property changes the attribute. But not *all* attributes are reflected as properties, and not all properties reflect attributes. People sometimes add their own custom properties to DOM objects. That's what we call expando properties. These are not attributes. Technically (again) it would be possible that a browser would not allow custom properties on the DOM objects it provides, but fortunately (again) none of the major browsers has a problem with it. And so we can do things like this: š š var div = $('mydiv'); š š div.foo = bar; ...and later we can refer to `$('mydiv').foo` and get back the string bar. This is very convenient, but you need to be careful with it, especially on IE
[Proto-Scripty] Re: Expando or data- like attributes?
T.J., thanks for an exhaustive explanation! But, as I understud, expando properties == custom attributes and its not good, but I see expando on extended elements in prototype! Will this to migrate to storage functionality or its not so bad practice? On 20 окт, 12:51, T.J. Crowder t...@crowdersoftware.com wrote: Hi, maybe I'm confusing javascript properties to the attributes? Yes, I think you are. Easy enough to do, but they're really quite distinct things. HTML elements have attributes, which (initially) come from the markup and are accessible via the DOM methods `getAttribute` and `setAttribute` (Prototype provides `readAttribute` and `writeAttribute` that you should use instead, as they fix lots of oddities -- particularly in IE -- related to certain attributes.) Attributes are not properties. JavaScript objects have properties. The objects browsers provide to JavaScript to represent the DOM are sufficiently like JavaScript objects that they also have properties. (This needn't necessarily have been the case, host-provided objects can follow just about any rules they want, but in practice -- fortunately -- even IE made it possible for the objects themselves to have JavaScript-like properties.) Some attributes are _reflected_ as properties. The classic example is the class attribute, which is reflected by the `className` property. Setting the attribute changes the property; setting the property changes the attribute. But not *all* attributes are reflected as properties, and not all properties reflect attributes. People sometimes add their own custom properties to DOM objects. That's what we call expando properties. These are not attributes. Technically (again) it would be possible that a browser would not allow custom properties on the DOM objects it provides, but fortunately (again) none of the major browsers has a problem with it. And so we can do things like this: var div = $('mydiv'); div.foo = bar; ...and later we can refer to `$('mydiv').foo` and get back the string bar. This is very convenient, but you need to be careful with it, especially on IE. Firstly, you need to be sure you're not using a property name that the browser is already using for something else! Secondly, you need to be sure that you don't create circular references between DOM elements and JavaScript objects when you do that, because that causes memory leaks on IE. That's why libraries like Prototype provide a means of storing metadata on elements via their APIs (I think on Prototype it's `Element#getStorage`), so they can take care to avoid issues for you. People sometimes add their own *attributes* to HTML elements, usually in the markup to associate further information with the element. For instance, recently I ran into someone who put all of the weights on a page into spans so that users could easily toggle between pounds and kilos in the display using JavaScript, but he couldn't figure out how to do it. I suggested using a custom attribute to hold the canonical weight (what they have in their database) and then toggling the content of the span based on what the user prefers. For 15 years, custom attributes on HTML elements in the markup have been *invalid* -- they would not pass the validation suites that people use to check their markup. The HTML5 working group recognized the value of custom attributes, but also the danger in people just defining things willy- nilly, and so they defined the data- prefix. You can't have your own weight attribute, but you can have your own data-weight attribute. I use custom attributes (*always* with the data- prefix) for conveying information in the markup that I later want to access from script, like the data-weight attribute above. I also use them if I need to be able to search for elements that have a certain piece of information on them. For instance, in the weights example, it's trivial to find the spans we need to change when the user changes the display from kgs to lbs: $$('span[data-weight]').each(...); If we used an expando property that we added to the elements after page load, we wouldn't be able to use that selector. I use expando properties (or data storage via an API) when I need to associate information with an element that I don't need to convey via markup or search for later with a selector. This is just to cut out the overhead of reading and writing attributes to the underlying DOM, and because properties can be things other than strings. In practice, I find I have virtually no use for expando properties in my applications (I use elements to *represent* application objects, not *as* application objects), but they're frequently useful in library code. Hopefully that rambling was of some use. :-) Happy coding, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 20, 4:34 am, buda www...@pochta.ru wrote
[Proto-Scripty] Expando or data- like attributes?
I'm confused at all. On the one hand HTML declares the existence of the elements expando- attributes. On the other hand HTML5 says that all illegal attributes must begin with data-. What should I do? continue to use espando or a new style of naming attributes with the data-? Prototype.js uses expando attributes - should I do the same? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Expando or data- like attributes?
Or should I use .storage object? But in this case I couldnt do search like $$('p[myAttr=foo]') On 20 окт, 01:59, buda www...@pochta.ru wrote: I'm confused at all. On the one hand HTML declares the existence of the elements expando- attributes. On the other hand HTML5 says that all illegal attributes must begin with data-. What should I do? continue to use espando or a new style of naming attributes with the data-? Prototype.js uses expando attributes - should I do the same? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Expando or data- like attributes?
maybe I'm confusing javascript properties to the attributes? how do they compare? On 20 окт, 02:03, buda www...@pochta.ru wrote: Or should I use .storage object? But in this case I couldnt do search like $$('p[myAttr=foo]') On 20 окт, 01:59, buda www...@pochta.ru wrote: I'm confused at all. On the one hand HTML declares the existence of the elements expando- attributes. On the other hand HTML5 says that all illegal attributes must begin with data-. What should I do? continue to use espando or a new style of naming attributes with the data-? Prototype.js uses expando attributes - should I do the same? Thanks -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype?
+1 On 6 окт, 17:47, Phil Petree phil.pet...@gmail.com wrote: Jquery is succeeding because they are building a consolidated (all-in-one-place) community with forums for dicussions of varied topics, a single place to download plugins etc. Prototype may be the better framework but he with the larger community will ultimately prevail and this is a lesson that microsoft has learned, taught, forgotten and had to learn again. I'm just sayin... 2010/10/5 Walter Lee Davis wa...@wdstudio.com It's a big scary ocean (JavaScript) and many many boats (Prototype, jQuery, EXT, Moo, YUI, I forget about a dozen more). Use what works for you, and let the competition between the various kits give rise to solutions you can use. Or write some extensions to Prototype to do the things you need. Walter On Oct 5, 2010, at 7:31 PM, buda wrote: But many developers needs in such extensions on prototype and in big amount of ready to use gadgets like in jQuery I realize that jQuery has alot of problrms and not such grained like prototype but such Microsofts tensions will lead many developers to jQuery ((( On 5 окт, 23:39, Alex McAuley webmas...@thecarmarketplace.com wrote: I dont know whether to be happy or sad that Microsoft are adding things to jQuery... They have a tendancy to mess things up on a grand scale! Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, October 05, 2010 5:54 PM Subject: [Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype? Hi, Well, Prototype's had templates for years: http://api.prototypejs.org/language/template/ It's true, though, jQuery is seeing a lot of investment and interest. These three Microsoft plugins themselves aren't all that much to write home about (though the globalization is exciting), but the _fact_ of them coming on the heels of Microsoft's recently re-upping their commitment to jQuery is significant. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 5, 3:52 pm, buda www...@pochta.ru wrote: jQuery is developing very quickly. Unfortunately it must be noted that this development forced to move to jQuery although I prefer the prototype. On 5 , 17:14, buda www...@pochta.ru wrote: http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-da. .. This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Microsoft announced new useful plugins on JQuery - what about prototype?
http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-data-link-and-globalization-accepted-as-official-jquery-plugins.aspx This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype?
jQuery is developing very quickly. Unfortunately it must be noted that this development forced to move to jQuery although I prefer the prototype. On 5 окт, 17:14, buda www...@pochta.ru wrote: http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-da... This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype?
http://blog.jquery.com/2010/10/04/new-official-jquery-plugins-provide-templating-data-linking-and-globalization/ On 5 окт, 17:14, buda www...@pochta.ru wrote: http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-da... This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype?
Well, one can not give up! Prototypes are quite mature and a good library should only create as Microsoft sites such miniprojects here and the whole community to develop them, and we will long stand in the place! On 5 окт, 19:54, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Well, Prototype's had templates for years:http://api.prototypejs.org/language/template/ It's true, though, jQuery is seeing a lot of investment and interest. These three Microsoft plugins themselves aren't all that much to write home about (though the globalization is exciting), but the _fact_ of them coming on the heels of Microsoft's recently re-upping their commitment to jQuery is significant. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 5, 3:52 pm, buda www...@pochta.ru wrote: jQuery is developing very quickly. Unfortunately it must be noted that this development forced to move to jQuery although I prefer the prototype. On 5 окт, 17:14, buda www...@pochta.ru wrote: http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-da... This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype?
But many developers needs in such extensions on prototype and in big amount of ready to use gadgets like in jQuery I realize that jQuery has alot of problrms and not such grained like prototype but such Microsofts tensions will lead many developers to jQuery ((( On 5 окт, 23:39, Alex McAuley webmas...@thecarmarketplace.com wrote: I dont know whether to be happy or sad that Microsoft are adding things to jQuery... They have a tendancy to mess things up on a grand scale! Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, October 05, 2010 5:54 PM Subject: [Proto-Scripty] Re: Microsoft announced new useful plugins on JQuery - what about prototype? Hi, Well, Prototype's had templates for years:http://api.prototypejs.org/language/template/ It's true, though, jQuery is seeing a lot of investment and interest. These three Microsoft plugins themselves aren't all that much to write home about (though the globalization is exciting), but the _fact_ of them coming on the heels of Microsoft's recently re-upping their commitment to jQuery is significant. -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Oct 5, 3:52 pm, buda www...@pochta.ru wrote: jQuery is developing very quickly. Unfortunately it must be noted that this development forced to move to jQuery although I prefer the prototype. On 5 , 17:14, buda www...@pochta.ru wrote: http://weblogs.asp.net/scottgu/archive/2010/10/04/jquery-templates-da... This is very useful - this must be in prototype too! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: pMask: a tool to mask input data
good work! thanks On 6 мар, 15:06, green greenlaw...@gmail.com wrote: Hi, I have port Fabio Zendhi Nagao's iMaskhttp://zendold.lojcomm.com.br/imask/tool to prototype with changes (or, you can say, enhancements). You can download it athttp://github.com/greenlaw110/pMask/ Thx, Green -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why element never receives an event?
thats it, but if form1 fires an event 'form:updated' - input element never receives that event, but I need it On Feb 3, 3:05 pm, ColinFine colin.f...@pace.com wrote: On Feb 2, 3:29 pm, buda www...@pochta.ru wrote: I need to receive message fired by form in forms element If you mean that you want the input element to observe the user- defined event, form1.select('input').invokde('observe', 'form:updated', function ... ); If that's not what you mean, I don't understand. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why element never receives an event?
Now I know that an events bubble up, but I need form elements receive an event fiered by a form - so I ask for a help here On Feb 3, 3:15 pm, Mona Remlawi mona.reml...@gmail.com wrote: hello buda, as T.J. Crowder mentioned above, firing an event means that the event is going to fire *up* the DOM. so it's only natural that firing an event in the form level won't get captured by one of its children. so for the sake of this discussion, what you really need is an event dispatcher/register mechanism and for that, i advise you to take a look athttp://positionabsolute.net/blog/2007/06/event-dispatcher.php cheers -- mona On Wed, Feb 3, 2010 at 2:10 PM, buda www...@pochta.ru wrote: thats it, but if form1 fires an event 'form:updated' - input element never receives that event, but I need it On Feb 3, 3:05 pm, ColinFine colin.f...@pace.com wrote: On Feb 2, 3:29 pm, buda www...@pochta.ru wrote: I need to receive message fired by form in forms element If you mean that you want the input element to observe the user- defined event, form1.select('input').invokde('observe', 'form:updated', function ... ); If that's not what you mean, I don't understand. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why element never receives an event?
I've understood it :) so will wait for proper event system in IE from now on :) On Feb 3, 11:59 pm, T.J. Crowder t...@crowdersoftware.com wrote: Now I know that an events bubble up, but I need form elements receive an event fiered by a form - so I ask for a help here And I need Internet Explorer to conform to standards properly. Doesn't mean it's going to happen. ;-) What you're saying you need doesn't make sense in terms of the DOM's event mechanism. Basically, you want the standard observer pattern. That's why Mona pointed you at an alternative means of dispatching events that isn't tied to the DOM's concept of how they should work. -- T.J. On Feb 3, 1:22 pm, buda www...@pochta.ru wrote: Now I know that an events bubble up, but I need form elements receive an event fiered by a form - so I ask for a help here On Feb 3, 3:15 pm, Mona Remlawi mona.reml...@gmail.com wrote: hello buda, as T.J. Crowder mentioned above, firing an event means that the event is going to fire *up* the DOM. so it's only natural that firing an event in the form level won't get captured by one of its children. so for the sake of this discussion, what you really need is an event dispatcher/register mechanism and for that, i advise you to take a look athttp://positionabsolute.net/blog/2007/06/event-dispatcher.php cheers -- mona On Wed, Feb 3, 2010 at 2:10 PM, buda www...@pochta.ru wrote: thats it, but if form1 fires an event 'form:updated' - input element never receives that event, but I need it On Feb 3, 3:05 pm, ColinFine colin.f...@pace.com wrote: On Feb 2, 3:29 pm, buda www...@pochta.ru wrote: I need to receive message fired by form in forms element If you mean that you want the input element to observe the user- defined event, form1.select('input').invokde('observe', 'form:updated', function ... ); If that's not what you mean, I don't understand. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.-Hidequoted text - - Show quoted text -- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why element never receives an event?
I need to receive message fired by form in forms element On Feb 2, 3:55 pm, ColinFine colin.f...@pace.com wrote: On Feb 1, 11:26 am, buda www...@pochta.ru wrote: how to register a handler for processing the message form its elements in right way? If you want to trigger the event on updating any 'input' element on the form: form1.select('input').invoke('observe', 'update', function() { ... }); -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Why element never receives an event?
On the form form1 is an element MyElement I attach to MyElement event handler MyElement.observe ( 'form: updated', function (e ){...}); then in the code generating the event form1.fire ( 'form: updated'); but the handler is not called for MyElement Why? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Why element never receives an event?
how to register a handler for processing the message form its elements in right way? On 1 фев, 13:16, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Events bubble *up* through the DOM, not down. Form elements are descendants of forms. If you fired the event on the form element, the form could see it; but not the other way around. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Feb 1, 11:02 am, buda www...@pochta.ru wrote: On the form form1 is an element MyElement I attach to MyElement event handler MyElement.observe ( 'form: updated', function (e ){...}); then in the code generating the event form1.fire ( 'form: updated'); but the handler is not called for MyElement Why?- Скрыть цитируемый текст - - Показать цитируемый текст - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] how to check is the function = Prototype.emptyFunction ?
var Obj = {}; Obj.meth = Prototype.emptyFunction; if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } why alert show everytime? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?
the question is: how to check if a function is empty or have any code On Feb 1, 5:18 pm, Richard Quadling rquadl...@googlemail.com wrote: On 1 February 2010 13:02, buda www...@pochta.ru wrote: var Obj = {}; Obj.meth = Prototype.emptyFunction; if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } why alert show everytime? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. Why? The main advantage of the emptyFunction is that you can always call it without having to do a null/undefined test first. If you want to know if it has been assigned something, then don't assign the emptyFunction, leave it as null and then test if it is null. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE :http://www.experts-exchange.com/M_248814.html EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA :http://uk.zopa.com/member/RQuadling- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?
it was simple sheme and it wasnt the stright code it must be like this var Obj = {}; ... Obj.meth = Prototype.emptyFunction; ... if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } does this irritates you? On Feb 1, 5:37 pm, Alex Wallace alexmlwall...@gmail.com wrote: This is getting into dirty territory (or at least I'd feel so) but: var x = function(){}; var y = function(){ alert(foo); } x + ; function () { } y + ; function () { alert(foo); } Best, Alex On Mon, Feb 1, 2010 at 10:29 AM, buda www...@pochta.ru wrote: the question is: how to check if a function is empty or have any code On Feb 1, 5:18 pm, Richard Quadling rquadl...@googlemail.com wrote: On 1 February 2010 13:02, buda www...@pochta.ru wrote: var Obj = {}; Obj.meth = Prototype.emptyFunction; if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } why alert show everytime? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/prototype-scriptaculous?hl=en. Why? The main advantage of the emptyFunction is that you can always call it without having to do a null/undefined test first. If you want to know if it has been assigned something, then don't assign the emptyFunction, leave it as null and then test if it is null. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE :http://www.experts-exchange.com/M_248814.html EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA :http://uk.zopa.com/member/RQuadling-Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: how to check is the function = Prototype.emptyFunction ?
Richard, thanks it works On Feb 1, 6:12 pm, Richard Quadling rquadl...@googlemail.com wrote: On 1 February 2010 15:44, buda www...@pochta.ru wrote: it was simple sheme and it wasnt the stright code it must be like this var Obj = {}; ... Obj.meth = Prototype.emptyFunction; ... if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } does this irritates you? On Feb 1, 5:37 pm, Alex Wallace alexmlwall...@gmail.com wrote: This is getting into dirty territory (or at least I'd feel so) but: var x = function(){}; var y = function(){ alert(foo); } x + ; function () { } y + ; function () { alert(foo); } Best, Alex On Mon, Feb 1, 2010 at 10:29 AM, buda www...@pochta.ru wrote: the question is: how to check if a function is empty or have any code On Feb 1, 5:18 pm, Richard Quadling rquadl...@googlemail.com wrote: On 1 February 2010 13:02, buda www...@pochta.ru wrote: var Obj = {}; Obj.meth = Prototype.emptyFunction; if (Obj.meth !== Prototype.emptyFunction) { alert('Not equal'); } why alert show everytime? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/prototype-scriptaculous?hl=en. Why? The main advantage of the emptyFunction is that you can always call it without having to do a null/undefined test first. If you want to know if it has been assigned something, then don't assign the emptyFunction, leave it as null and then test if it is null. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE :http://www.experts-exchange.com/M_248814.html EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA :http://uk.zopa.com/member/RQuadling-Hidequoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.-Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. Can you try ... alert((Obj.meth + '') == (Prototype.emptyFunction + '')); I'm getting True for when Obj.meth is the emptyFunction. -- - Richard Quadling Standing on the shoulders of some very clever giants! EE :http://www.experts-exchange.com/M_248814.html EE4Free :http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731 ZOPA :http://uk.zopa.com/member/RQuadling- Hide quoted text - - Show quoted text - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Couldnot solve the problem with call class method with parameters
I'm sorry, I was wrong - I incorrectly described the function declaration in inherited object Thanks for response On 28 янв, 00:23, T.J. Crowder t...@crowdersoftware.com wrote: Hi, As quoted, that code is fine and will work if you do this: var x = new TObj(); x.metod1(); ...that will call x.method2 with a = 1, b = 2. Can you give a complete example[1] demonstrating the problem? [1]http://proto-scripty.wikidot.com/self-contained-test-page -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Jan 27, 8:00 pm, buda www...@pochta.ru wrote: I have a class var TObj = Class.create({ initialize: function() {... }, metod1: function() { this.method2(1,2); --- cal method2 with parameters }, method2: function(a, b){ var aa = a; -- a b is undefined! } }); why in method2 parameters a and b is undefined?- Скрыть цитируемый текст - - Показать цитируемый текст - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Couldnot solve the problem with call class method with parameters
I have a class var TObj = Class.create({ initialize: function() {... }, metod1: function() { this.method2(1,2); --- cal method2 with parameters }, method2: function(a, b){ var aa = a; -- a b is undefined! } }); why in method2 parameters a and b is undefined? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] attach one observer for many events to an element
What is the best way to attach one observer to many events for examle: I need to attach an observer to input element to validate input value for 'change' and 'paste' events -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: attach one observer for many events to an element
thanks for samples On 17 дек, 17:40, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Just reuse the same handler for multiple events: function handler(event) { /* ... */ } element .observe('change', handler) .observe('paste', handler); If you need to bind, do that first so you're not creating unnecessary extra functions: var Thingy = Class.create((function() { function handler(event) { /* ... */ } function hookUsUp(element) { var boundHandler = handler.bind(this); element .observe('change', boundHandler) .observe('paste', boundHandler); } return {hookUsUp: hookUsUp}; })()); HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 17, 2:03 pm, buda www...@pochta.ru wrote: What is the best way to attach one observer to many events for examle: I need to attach an observer to input element to validate input value for 'change' and 'paste' events- Скрыть цитируемый текст - - Показать цитируемый текст - -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] How to detect who is click button - user or script like this btn.click()?
I need to distinguish between inside the handler-pressed the button is pressed by user or by code like this: btnclick (btn). In the event no difference! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---