Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-2380

[JavaScript][t5/core/dom] missused target on eventlink

    XMLWordPrintableJSON

Details

    Description

      Setup: t5.4-beta-15 with jquery only.

      I used an EventLink like this :

      <t:eventlink t:event="saveATree" async="true" id="saveButton" class="btn btn-success">
          <span class="fa fa-tree" />
          <span class="hidden-xs hidden-sm">Sauver un arbre</span>
      </t:eventlink>
      

      I think i got it right because it works when I click on it until I precisely click on the icon or the text. Then, it doesn't call the url I want it to.

      I debugged the js code and it appears that in the jquery.event, the property target is the actual clicked element (in my example, the span). So when the callback is called, this equal to my span element and does not contain any href attribute.

      I can't provide a patch but the fix is quite simple... you just need to use the currentTarget property instead of target in the event wrapper (line 148 in t5-core-dom.coffee). I also think that it should be easy to write a test for this bug.

      Attachments

        Activity

          People

            jkemnade Jochen Kemnade
            Charlouze Charles Capon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: