diff options
Diffstat (limited to 'chromium/ui/keyboard/resources/elements/kb-altkey-data.html')
-rw-r--r-- | chromium/ui/keyboard/resources/elements/kb-altkey-data.html | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/chromium/ui/keyboard/resources/elements/kb-altkey-data.html b/chromium/ui/keyboard/resources/elements/kb-altkey-data.html index 8f8b9a96420..67f793ad4b1 100644 --- a/chromium/ui/keyboard/resources/elements/kb-altkey-data.html +++ b/chromium/ui/keyboard/resources/elements/kb-altkey-data.html @@ -10,8 +10,21 @@ var altKeys = {}; var idMap = {}; - function createId(char) { - return 'id' + char.charCodeAt(0); + /** + * Creates a unique identifier based on the key provided. + * This identifier is of the form 'idHASH' where HASH is + * the concatenation of the keycodes of every character in the string. + * @param {string} key Key for which we want an identifier. + * @return {string} The unique id for key. + */ + function createId(key) { + var hash = key.split('').map( + // Returns the key code for the character. + function(character) { + return character.charCodeAt(0); + } + ).join(''); + return 'id' + hash; } Polymer('kb-altkey-data', { @@ -21,7 +34,7 @@ * @param {string} char The base character. * @param {boolean=} opt_force If true, force the creation of a list * even if empty. Used when constructing a set of alternates for keys - * with superscripts. + * with hintTexts. * @return {?Object.{id: string, list: string}} */ getAltkeys: function(char, opt_force) { |