Hi all,

I'm posting a new subject to avoid thread necromancy, but this message
refers to a brief discussion that took place here in March 2010.

Since Prototype1.7 is approaching, I looked at the CHANGELOG and
didn't see anything related to this topic.

The doc on event.memo (http://api.prototypejs.org/dom/event/fire/)
says

memo  – Metadata for the event. Will be accessible through the event's
memo property.

If I fire an event without providing any memo, event.memo will be set
to an empty object. Why not, but it should be in the documentation.

But when I fire an event with a string as the memo argument, I will
sometimes lose this string because it will be replaced by an empty
object! This will happen everytime the string argument is an empty
string, because Prototype checks the boolean value of the memo
argument!

So basically, I have an API that let me use a primitive String as
argument for event.memo, but will sometimes replace it with something
completly different.

I suggest one of two corrections:

Either Event#fire sets the memo argument to an empty object only if
said argument is undefined:

<      event.memo = memo || {};
>      event.memo = Object.isUndefined(memo) ? {} : memo;

,or Event#fire requires the memo is an Object if it is not undefined:


<      event.memo = memo || {};
>      event.memo = Object.isUndefined(memo) ? {} : memo;
>      if(Object.isString(memo) || Object.isNumber(memo)

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en

Reply via email to