[Prototype-core] Re: For() loops, ++i, i++, i+=1

2009-12-16 Thread Yaffle
++i; is a little more efficient in C language, in javascript difference in performance of all these operators is tiny On Dec 16, 3:21 pm, RQuadling wrote: > Hi. > > Is there any consensus on which is more efficient in a for() loop? > > I was taught that for ++i being the most efficient. > > I've

[Prototype-core] Re: Native JSON breakage

2009-12-01 Thread Yaffle
I'm waiting prototype.js 1.7 too. -- You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com

[Prototype-core] Re: Native JSON breakage

2009-12-01 Thread Yaffle
Add this code after prototype.js =). Also this code replaces FF 3.5 Native JSON.stringify with ES compatible... It breaks compatibility! delete String.prototype.toJSON; //! deleting this properties required to save FF 3.5 Native JSON.stringify delete Array.prototype.toJSON; //! delete Number.prot

[Prototype-core] Re: Suggestion: String#isEmpty instead String#empty

2009-10-02 Thread Yaffle
+1 for REMOVE this methods --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to

[Prototype-core] Re: Suggestion: DOM storage methods to Prototype

2009-09-30 Thread Yaffle
May I ask you about localStorage? I want to update some property, but no space left on device and FireFox throws error "NS_ERROR_FILE_NO_DEVICE_SPACE", so "localStorage[property]" stays unchanged. try{ localStorage[property] = value; //throws "NS_ERROR_FILE_NO_DEVICE_SPACE" }catch(e){ localS

[Prototype-core] Re: Suggestion: DOM storage methods to Prototype

2009-09-29 Thread Yaffle
Yes that's is, but Safari and Chrome isn't popular browsers.(depends on site audience) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@goog

[Prototype-core] Re: Suggestion: DOM storage methods to Prototype

2009-09-29 Thread Yaffle
I use "small" (40 lines of code) storage class, that uses cookies or localStorage. IMHO, userData and databases not so usefull: IE userData behavior relies on DOM. database works in webkit, which supports localStorage. --~--~-~--~~~---~--~~ You received this messa

[Prototype-core] Re: bug report - sorry, I didn't find the other way to report bugs in prototype.js

2009-09-25 Thread Yaffle
https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/810-fix-eventstopobserving-to-return-element On 25 сен, 19:17, "T.J. Crowder" wrote: > Hi, > > > I didn't find the other way to report bugs in prototype.js > > It's described here:http://prototypejs.org/contribute > > > i am qui

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-23 Thread Yaffle
https://prototype.lighthouseapp.com/projects/8886-prototype/tickets/807-fix-hash-class-to-use-prefix --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to protot

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-21 Thread Yaffle
base2.js uses prefix for it's "Map" Class On 14 сен, 19:53, Yaffle wrote: > > > Sorry, I'm not following again :) What's not necessary? Which requests > > > will be more expensive? > > May be, for-in loop will iterate a little more ... --~--~--

[Prototype-core] Re: isLeftClick and IE8

2009-09-20 Thread Yaffle
http://groups.google.com/group/prototype-core/browse_thread/thread/d8faa05113019c23?hl=en On Sep 21, 7:58 am, Vaie Lab wrote: > Hi, > > I have this code: > > my_element.observe('click', function(event) { >         event.stop(); >         if (event.isLeftClick()) { >           alert('test'); >  

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-14 Thread Yaffle
> > Sorry, I'm not following again :) What's not necessary? Which requests > > will be more expensive? May be, for-in loop will iterate a little more ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: C

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-14 Thread Yaffle
There is an issue with Hash#toObject method... I think, Ajax.Base#parameters can be Hash instead of object to avoid call to Hash#toObject... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. T

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-14 Thread Yaffle
var Hash = Class.create(Enumerable, (function() { function specialClone(source,propertyFunc){ propertyFunc = propertyFunc || Prototype.K; var destination = {}; for (var property in source) { destination[propertyFunc(property)] = source[property]; } return destination;

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-13 Thread Yaffle
What object creation? javascript:alert(window.localStorage.__proto__) On 14 сен, 05:56, kangax wrote: > On Sep 13, 6:38 pm, Tobie Langel wrote: > > > > Why not to patch Hash to use some prefix for keys? > > > That was my plan for 1.7, actually. > > > It fixes that issue and also avoids creat

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-13 Thread Yaffle
You're right, `hasOwnProperty` can be useless, and `propertyIsEnumerable` is useless becauseof dontEnum IE bug... Why not to patch Hash to use some prefix for keys? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Pr

[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)

2009-09-13 Thread Yaffle
++IE dontEnum bug =) var h = $H({}); h.set('toString',1); alert(h.toJSON()); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.

[Prototype-core] $H({}).get('__proto__') in Firefox =)

2009-09-13 Thread Yaffle
var h = $H({}); h.set('__proto__','sadfdsf'); alert( typeof( h.get('__proto__') )); Also try these: alert(Object.toQueryString('hasOwnProperty=1'.toQueryParams())); // hasOwnProperty=function%20()%20%7B%20%5Bnative%20code%5D %20%7D&hasOwnProperty=1 May be "Object.prototype.hasOwnProperty.call(

[Prototype-core] Re: True Hashes using objects as keys

2009-09-11 Thread Yaffle
May I ask you ? Can I use Hash or vanilla objects for storing [key,value] with key==='constructor' or key==='prototype' ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this grou

[Prototype-core] Re: Template Class

2009-08-27 Thread Yaffle
; complexity. > > > It uses `String#replace` instead of `String#gsub` and thus performs   > > > better. > > > Do you guys see any enhancements (in terms of performance or code   > > > size) that could be made ? > > > > Diff:http://github.com/samleb/prot

[Prototype-core] Event#isLeftClick works only for mouse down/up in IE, may be this information will be useful in documentation?

2009-08-25 Thread Yaffle
??? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr.

[Prototype-core] Re: Template Class

2009-08-12 Thread Yaffle
You should use Strings interpolate function for this. A template is > meant to be reused many times with many different filler values. > > On Jun 14, 10:41 am, Yaffle wrote: > > > > > var Template = Class.create({ > >   initialize: function(template, pattern){ > >  

[Prototype-core] Re: Suggested addition to Function Methods: .repeat(seconds[, arg...])

2009-06-24 Thread Yaffle
I use Function.prototype.watch instead of Abstract.TimedObserver Function.prototype.watch = function(delay,onChange){ var __method = this, value= __method(); return setInterval(function(){ var v = __method(); if(v!==value){ onChange(v); value = v;

[Prototype-core] Re: Adding a object data to PeriodicalExecuter

2009-06-23 Thread Yaffle
Why you can't use closure or Function#curry based on it? (new PeriodicalExecuter(function(someData){ var x = someData.num; // }.curry({ num: 1, text: "string" }))); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[Prototype-core] Re: Template Class

2009-06-14 Thread Yaffle
var Template = Class.create({ initialize: function(template, pattern){ var parts = template.toString().split(pattern || Template.Pattern), pl = parts.length, pattern2 = /^([^.\[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; for(var i=1,k=1;ihttp://groups.google.com/group/prototype-

[Prototype-core] Re: Template Class

2009-06-13 Thread Yaffle
var Template = Class.create({ initialize: function(template, pattern) { this.template = template.toString(); pattern = pattern || Template.Pattern; if (!Object.isString(pattern) && pattern.global) pattern = new RegExp(pattern.source); this.pattern = pattern; var parts

[Prototype-core] Template Class

2009-06-13 Thread Yaffle
Why Template Class can't split template string when initializing? Example: function xTemplate(template){ var a = template.split(Template.Pattern), l = a.length; return function(object){ var x = a[0]; for(var i=1;ihttp://blog.stevenlevithan.com/archives/cross-browser-split . -

[Prototype-core] Array.prototype.push.apply and "update" used by Function.prototype.bind

2009-04-24 Thread Yaffle
function update(array, args) { var arrayLength = array.length, length = args.length; while (length--) array[arrayLength + length] = args[length]; return array; } Array.prototype.push.apply(array,args) == update(array,args) ? --~--~-~--~~~---~--~~ Y

[Prototype-core] Re: alert('test'.stripTags());

2009-04-24 Thread Yaffle
String#prototype#split Great Fix http://blog.stevenlevithan.com/archives/cross-browser-split --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-c

[Prototype-core] alert('test'.stripTags());

2009-04-22 Thread Yaffle
var tag = /<\/?\w+(?:\s+\w+(?:\s*=\s*(?:(?:"(?:\\.|[^"])*")| (?:'(?:\\.|[^'])*')|[^>\s]+))?)*\s*\/?>/gim; var tagName = /^<\/?(\w+)/im; String.prototype.stripHTMLTags = function(tagsToKeep){ if(tagsToKeep) tagsToKeep = tagsToKeep.invoke('toLowerCase'); return this.repla

[Prototype-core] Re: Function.prototype.defer

2009-03-29 Thread Yaffle
In this example may be used "new Element(..." But I have page, where I can't use it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@goog

[Prototype-core] Re: Function.prototype.defer

2009-03-29 Thread Yaffle
Thanks for your answer. Yes, that example may be very specific and so not fore core, but: http://prototypejs.org/assets/ 2009/3/27/prototype.js"> // asd'); (function(){

[Prototype-core] Function.prototype.defer

2009-03-29 Thread Yaffle
Should I use "defer" method for browsers, which doesn't need a moment to update "new markup"? May be Function.prototype could contain method, that will use defer for IE and run function immediately for other browsers? The defer method may slow page loading and may be cause errors. Sorry, for my "

[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread Yaffle
Hm i am stupid.., why this ticket is for 1.6.0.3 milestone? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubs

[Prototype-core] Re: _each method and context

2009-02-16 Thread Yaffle
Hm i am stupid.., why this ticket is for 1.6.0.3 milestone? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsub

[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread Yaffle
Good! My searching it on lighthouse was not succeful... kangax: > On Feb 16, 8:56 am, Yaffle wrote: > > Function.prototype.bind may work 2 times faster, if when calling bind > > with one argument,it would return function without "arg.concat" > > >

[Prototype-core] Re: Function.prototype.bind optimization

2009-02-16 Thread Yaffle
Sorry, It's not bind optimization. It's optimization of function returned by "bind". --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@google

[Prototype-core] Function.prototype.bind optimization

2009-02-16 Thread Yaffle
Function.prototype.bind may work 2 times faster, if when calling bind with one argument,it would return function without "arg.concat" bind: function() { if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; var __method = this, args = $A(arguments), object = args.sh

[Prototype-core] _each method and context

2009-02-16 Thread Yaffle
Hello, Why with JavaScript <= 1.5, Array.prototype._each method doesn't use a context object like Array.prototype.forEach(callback[, thisObject]) in JavaScript 1.6 or Enumerable.prototype.each(iterator[, context]) ? thank you. --~--~-~--~~~---~--~~ You recei

[Prototype-core] Re: Can the community do anything to help make bugfix releases more frequent?

2009-02-06 Thread Yaffle
May be it's time to make 1.6.0.4 version? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group,

[Prototype-core] Re: Prototype in French

2009-01-05 Thread Yaffle
А Смысл? В API вроде все по-русски написано, Все равно надо код смотреть чаще, если что не понятно. Вот в коде уже есть вопросы зачем On Jan 5, 6:58 pm, Cyril CHARLIER wrote: > Hi all, > > is there a way to translate the API or Doc to French ? > > I started a translation when it was version 1

[Prototype-core] Ajax.PeriodicalUpdater inherit Ajax.Base

2009-01-03 Thread Yaffle
Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { $super(); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); this.decay = (this.options.decay || 1); } I don't undestand... Why Ajax.PeriodicalUpdater should inherit Ajax.Base propertie

[Prototype-core] Re: Protopacked distribution

2008-12-01 Thread Yaffle
You may use Packer at http://dean.edwards.name/packer/ Better use Minifer (or don't use "Base62 encode" for Packer) and gzip js files on you server. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core"

[Prototype-core] function for script loading

2008-11-19 Thread Yaffle
hello I can't find in prototype.js function, that can load javascript such as jsload http://code.google.com/p/jsload/downloads/list It may be very useful. How about add to prototype "lite version" of this function? --~--~-~--~~~---~--~~ You received this messag

[Prototype-core] normal scrollTo?

2008-11-18 Thread Yaffle
Oh, Who would be a hero and make good scrollTo and smoothscroll code? than will work on this example? http://hostel6.ru/cht/js/ prototype.js"> Prototype ScrollTo #red --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

[Prototype-core] Re: Prototype.js mistakes

2008-11-08 Thread Yaffle
sorry, for my english and thanks for your answer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from thi

[Prototype-core] Prototype.js mistakes

2008-11-07 Thread Yaffle
var Prototype = { // ScriptFragment: ']*>([\\S\\s]*?)<\/script>', // } May be next code would a little better? var Prototype = { // ScriptFragment: ']*>(?:)?< \/script>', // } and for: evalScripts: function() { return this.extractScripts().map(function(script) { return