W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2009

Re: convertKeyIdentifier

From: Maciej Stachowiak <mjs@apple.com>
Date: Tue, 22 Sep 2009 18:53:20 -0700
Cc: Doug Schepers <schepers@w3.org>, "www-dom@w3.org" <www-dom@w3.org>
Message-id: <0FEE981B-A9E5-406C-8840-45B7DAC93952@apple.com>
To: Anne van Kesteren <annevk@opera.com>

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);

This seems easier than this as a way to get a numeric unicode code  
point:
parseInt(document.convertKeyIdentifier(evt.keyIdentifier).substring(2))

Also, you can range check the actual string, so it's rare to need the  
code point at all:
if (evt.keyIdentifier >= "A" && evt.keyIdentifier <= "Z")

I don't think the U+XXXX string format does not add any value.

Regards,
Maciej
Received on Wednesday, 23 September 2009 01:54:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT