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 <smashl...@gmail.com> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to