Parsley.js adding span before error message-Collection of common programming errors

I’d like to add span element before every messages is Parsley.js. This code’s working for prepared messages but not for custom messages.

    /**
    * Add / override error message
    *
    * @method addMessage
    * @param {String} name Message name. Will automatically be binded to validator with same name
    * @param {String} message Message
    */
    , addMessage: function ( key, message, type ) {

      if ( 'undefined' !== typeof type && true === type ) {
        this.messages.type[ key ] = '' + message;
        return;
      }

      // custom types messages are a bit tricky cuz' nested ;)
      if ( 'type' === key ) {
        for ( var i in message ) {
          this.messages.type[ i ] = '' + message[ i ];
        }

        return;
      }

      this.messages[ key ] = '' + message;
    }
  };

Originally posted 2013-11-13 09:50:12.