Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
event.memo inconsistency
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Cédric Bertolini  
View profile  
 More options Jun 10 2010, 10:05 am
From: Cédric Bertolini <bertolini.ced...@gmail.com>
Date: Thu, 10 Jun 2010 07:05:37 -0700 (PDT)
Local: Thurs, Jun 10 2010 10:05 am
Subject: event.memo inconsistency
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 || {};


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Bertolini  
View profile  
 More options Jun 11 2010, 10:56 am
From: Cédric Bertolini <bertolini.ced...@gmail.com>
Date: Fri, 11 Jun 2010 07:56:01 -0700 (PDT)
Local: Fri, Jun 11 2010 10:56 am
Subject: Re: event.memo inconsistency
My message was somehow truncated yesterday, and the "patch" line
format is mistaken for a "usenet quote" format. Sorry about that.

Element#fire takes an object argument as memo. If the argument is
missing, an empty object is used instead. The problematic case is when
the argument is neither undefined nor an object : a primitive string
or number. In these cases, Element#fire silently discards the provided
argument and uses an empty object. I think this is bad design and
should be corrected.

Thanks for your time.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »