You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Julien Blatecky (JIRA)" <ji...@apache.org> on 2013/03/05 16:01:20 UTC

[jira] [Created] (TAP5-2077) ElementWrapper#onevent jQuery implementation can return a wrong ElementWrapper

Julien Blatecky created TAP5-2077:
-------------------------------------

             Summary: ElementWrapper#onevent jQuery implementation can return a wrong ElementWrapper
                 Key: TAP5-2077
                 URL: https://issues.apache.org/jira/browse/TAP5-2077
             Project: Tapestry 5
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.4
            Reporter: Julien Blatecky
         Attachments: elementwrapper.onevent.patch

Considers we bind an event on an element (<a> for example) and this element contains some other element (<span> for instance).
The event that will be triggered returns an ElementWrapper wrapping the span element if we clicked on span, instead of returning a wrapped element of the <a> element.

Consequently, in the case of a a[data-update-zone] containing some span or img elements, clicking on one of these elements raises a javascript error : "Attempt to wrap a null DOM element" when handling the callback.

Indeed, in the wrapped callback (line 95 in the coffeescript jquery dom) the ElementWrapper is instantiated with the "event.target" returned by jquery, which is not the element on which we defined the event, but the deeper element on which the event occurs. jQuery.com says "The target property can be the element that registered for the event or a descendant of it.", whereas "this" will be "the current DOM element within the event bubbling phase." just like "event.currentTarget".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira