[Proto-Scripty] Re: readAttribute for event attributes (onclick etc) fails

2009-07-16 Thread david

Hi Ilya,

don't be sorry, discovering bug, submit patch and test case take much
time, and I AM SORRY to ask you to repost :))
Those double google groups is not an evidence.

After posting on the prototype core group you should have to open a
ticket in LightHouse, so perhaps go directly there.

--
david



On 15 juil, 22:32, Ilya Furman  wrote:
> Oh, I'm sorry, will repost there, 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: readAttribute for event attributes (onclick etc) fails

2009-07-15 Thread Ilya Furman

Oh, I'm sorry, will repost there, 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: readAttribute for event attributes (onclick etc) fails

2009-07-15 Thread david

Hi,

patch, bug, discussion about prototype core, in a world what is not
about using prototype & scriptaculous has its own google group.
So this post will have much response in prototype-core google group:
http://groups.google.com/group/prototype-core.

Or with this patch, open a ticket to lighthouse:
https://prototype.lighthouseapp.com/projects/8886/home

To have full information on how to contribute, look at:
http://prototypejs.org/contribute

--
david

On 14 juil, 20:51, Ilya Furman  wrote:
> Since different IE versions returns differently wrapped anonymous
> function while reading element onclick (for example) _getEv method
> should use regular expression to parse function body rather that
> string.slice().
>
> I suggest following patch for this:
>
> diff --git a/src/dom.js b/src/dom.js
> index e9b878c..903030e 100644
> --- a/src/dom.js
> +++ b/src/dom.js
> @@ -808,7 +808,20 @@ else if (Prototype.Browser.IE) {
>          },
>          _getEv: function(element, attribute) {
>            attribute = element.getAttribute(attribute);
> -          return attribute ? attribute.toString().slice(23, -2) :
> null;
> +          if (attribute) {
> +              // matching function body from string like
> +              // "function onclick()\n{\nlocation.href = this.href
> \n}"
> +              if (attribute.toString().match(/^function/)) {
> +                var match = attribute.toString().match(/\{\n*(.+)\n*
> \}/);
> +                return match[1] ? match[1] : null;
> +              } else {
> +                // otherwise attribute was most likely dynamically
> set, so returning it
> +                return attribute;
> +              }
> +          } else {
> +            // return null if there is no attribute
> +            return null;
> +          }
>          },
>          _flag: function(element, attribute) {
>            return $(element).hasAttribute(attribute) ? attribute :
> null;
>
> Also, this fixes testElementReadAttribute test, that currently fails
> in IE8.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---