Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Keep old behavior on unsupported browsers (Safari)
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed Mar 3, 2015
1 parent 5af5433 commit 9da024b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/tags-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ tagsInput.directive('tagsInput', function($timeout, $document, tagsInputConfig)
/**
* validate comma key
*
* Event properties to verify ','
* Chrome: keyIdentifier: "U+002C"
* FF: key
* IE: char|key
* Safari: -
*
* @param e
* @returns {boolean}
*/
function validateComma(e) {
var originalEvent = e.originalEvent || e;
return (e.keyCode !== KEYS.comma) || (e.key || e.char) === ',' || originalEvent.keyIdentifier === 'U+002C';
var char = e.key || e.char || originalEvent.keyIdentifier;
var unsupported = typeof char === 'undefined';
return (unsupported || e.keyCode !== KEYS.comma) || char === ',' || char === 'U+002C';
}

return {
Expand Down

0 comments on commit 9da024b

Please sign in to comment.