Events on links by default

I realised that Yii adds by some reason an event to ALL my links. No matter if I create them with Html::a or with pure html, the following event is always binded to the link:




var handler = function(event) {

  var $this = $(this),

    method = $this.data('method'),

    message = $this.data('confirm');

 

  if (method === undefined && message === undefined) {

    return true;

  }

 

  if (message !== undefined) {

    pub.confirm(message, function() {

      pub.handleAction($this);

    });

  } else {

    pub.handleAction($this);

  }

  event.stopImmediatePropagation();

  return false;

}



Why does this happens? Some of my plugins are not working because of this weird behavior.

What event should Yii add?

Hi,

The reason is that yii recognize data-method and data-confirm html attributes. This helps building links or actions with specifics http method and to display confirmation message, for example:




<a href='item/delete?id=1' data-method='post' data-confirm='do you realy want to delete'>Delete</a>



If your plugins don’t use thoose attributes, they should not be affected by this behaviour.

what kind of error do you get ?