W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2011

Re: [DOMCore] argument name "interface" in Document.createEvent()

From: Ms2ger <ms2ger@gmail.com>
Date: Wed, 15 Jun 2011 13:03:39 +0200
Message-ID: <4DF8918B.8060201@gmail.com>
To: David Flanagan <dflanagan@mozilla.com>, www-dom@w3.org
CC: Cameron McCormack <cam@mcc.id.au>
On 06/15/2011 09:12 AM, Cameron McCormack wrote:
> David Flanagan:
>> The Document.createEvent() method is specified with an argument
>> named "interface". When mechanically translated into JavaScript,
>> this causes a syntax error, since "interface" is a reserved word in
>> JavaScript.  (And presumably in WebIDL, as well).
>
> Yeah, you would really need to write
>
>    Event createEvent(in DOMString _interface);
>
> to avoid a Web IDL syntax error, where the leading underscore is used
> as an escape: http://dev.w3.org/2006/webapi/WebIDL/#idl-names
>
> (There’s no requirement for the argument name in the IDL to be the same
> as the name of the argument in the implementation, though, so I think it
> would be safe to to write it as “_interface” there.)

I've gone with David's suggestion.

http://dvcs.w3.org/hg/domcore/rev/2f80779e3566

Thanks
Ms2ger
Received on Wednesday, 15 June 2011 11:04:08 GMT

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