W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

Re: [WebIDL] ES3.1 'flexible' attribute and 'delete' semantics

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Thu, 14 Aug 2008 18:10:50 -0700
Message-ID: <c9e12660808141810t5557741fy8cb4202de8c19971@mail.gmail.com>
To: "Web Applications Working Group WG" <public-webapps@w3.org>
On Thu, Aug 14, 2008 at 4:59 PM, Cameron McCormack <cam@mcc.id.au> wrote:
>
> Hi Garrett.
>
> Travis Leithead:
>> > My question, once again, is whether WebIDL will define exactly how
>> > to translate the behavior of operators like delete into the
>> > JavaScript language binding for DOM objects.
>
> Garrett Smith:
>> That isn't a question. This is: Why does WebIDL need to define how
>> delete works on Document.prototype.getElementById? There is no
>> guarantee that Document will be an object, or that Document.prototype
>> will be the [[Prototype]] of document. Nor should there be.
>
> Web IDL wouldn't specifically say "delete works on
> Document.prototype.getElementById", but I think it should say how these
> kinds of objects (Document, Document's [[Prototype]]) behave, e.g.
> "a property on an interface prototype object that corresponds to an IDL
> operation has attributes { DontEnum }".  JS libraries do exploit the
> prototype chain to add methods etc.,

Yes, there have been libraries that have made this mistake.

> so it would be good if they could
> do this with the blessing of a spec,

No, it would only encourage such design.

You'll see things like:

HTMLElement.prototype.dispatchEvent = function(e){
// ...
};

and then
if(extendedByLibrary)
  el.dispatchEvent(event);

The HTMLElement in one frame might not be the same as HTMLElement in
the other; that would seem to be a potential cross frame security
issue.

> rather than de factor behaviour.
> Given MS's interest in following Web IDL, there's a chance we could get
> all four browsers doing the same thing, too.

Document interface is an interface. An interface does not have defined
implementation; it is merely a contract. "IDL" is for "Interface
Definition".

The fact that some browsers expose Document as a global property does
not need standardization. It would not be bad to have DOM readonly
properties implemented with [[DontDelete]], [[ReadOnly]]. That could
be one line in WebIDL, e.g.

"DOM readonly properties have [[DontDelete]] and [[ReadOnly]]."

But it seems fairly obvious that this would have to be so, so it
wouldn't seem critical to include that.

Garrett

> --
> Cameron McCormack ≝ http://mcc.id.au/
>
>
Received on Friday, 15 August 2008 01:11:25 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:27 GMT