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

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 UTC