- // Look for a highlighted item first
- if ( highlightedItem ) {
- validated = this.addTag( highlightedItem.getData(), highlightedItem.getLabel() );
- } else if ( item ) {
- // Look for the element that fits the data
- validated = this.addTag( item.getData(), item.getLabel() );
- } else {
- // Otherwise, add the tag - the method will only add if the
- // tag is valid or if invalid tags are allowed
- validated = this.addTag( inputValue );