Re: convertKeyIdentifier

On Sep 23, 2009, at 9:50 AM, Olli Pettay wrote:

> On 9/23/09 4:53 AM, Maciej Stachowiak wrote:
>>
>> On Sep 22, 2009, at 9:27 AM, Anne van Kesteren wrote:
>>
>>>
>>>
>>>> this is a directly related to DOM3 Events key identifiers, and it
>>>> needs to be implemented in that context. Mozilla and Microsoft have
>>>> already agreed that we need this, BTW.
>>>
>>> Well, I disagree. I do not see the point in having this method as  
>>> I do
>>> not see the need for having multiple representations for  
>>> everything in
>>> the first place in the context of DOM Level 3 Events.
>>>
>>> Furthermore I think putting createEvent on Document was a mistake in
>>> to begin with. Especially with the design we have now where DOM  
>>> events
>>> are often used outside the context of documents. (Think of e.g. Web
>>> Workers.)
>>
>> I agree with Anne. I think we should remove the U+XXXX format  
>> entirely.
>> If you have a string like Q, you can convert it to a unicode numeric
>> value for range checking like this:
>>
>> var codePoint = evt.keyIdentifier.charCodeAt(0);
>
> If I haven't mistaken,
> charCodeAt(0) isn't quite enough. It returns values between
> 0-65536. One needs to check also charCodeAt(1).
> A helper method to get the codepoint easily in all cases could be  
> useful.

There are no key identifiers currently defined that correspond to  
characters that would be represented as surrogate pairs. Are there any  
keyboards that allow entering such characters directly?

Regards,
Maciej

Received on Wednesday, 23 September 2009 20:48:49 UTC