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

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

From: Cameron McCormack <cam@mcc.id.au>
Date: Wed, 15 Jun 2011 19:12:59 +1200
To: David Flanagan <dflanagan@mozilla.com>
Cc: www-dom@w3.org
Message-ID: <20110615071259.GB10370@wok.mcc.id.au>
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.)

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Wednesday, 15 June 2011 07:13:37 GMT

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