W3C home > Mailing lists > Public > public-html@w3.org > November 2008

Re: [WebIDL] Treatment of getters and setters

From: Cameron McCormack <cam@mcc.id.au>
Date: Tue, 18 Nov 2008 21:44:42 +1100
To: public-webapps@w3.org, public-html@w3.org
Cc: jonas@sicking.cc
Message-ID: <20081118104442.GA26915@arc.mcc.id.au>

Cameron McCormack:
> So, we probably need to keep requiring the spec using [NamedIndex] to
> specify in prose what the keys are.  That should be sufficient to
> nominate operations to be the property creator/modifier/deleter
> handlers.
> Then the operations could still handle that common case of being the
> setter/getter methods.
> How does that sound?

So I’ve done something similar to this, but reverting to the extended
attribute names that were used before.  There is now the option to place
[IndexGetter], [IndexSetter], [NameGetter], [NameSetter] (as well as the
new ones [IndexCreator], [IndexDeleter], [NameCreator] and
[NameDeleter]) on the interface itself, to allow their behaviour to be
specified in prose, or on an operation, in which case the behaviour is
taken from the behaviour specified for the operation.

A small amount of prose is still required to state what the valid
indices or names are for a given object.

I’ve reinstated the definition of [[Put]] for host objects to handle
[IndexSetter], [IndexCreator], [NameSetter] and [NameCreator].  I’ve
also added a definition for [[Delete]] for host objects to handle
[IndexDeleter] and [NameDeleter].



The terminology in places still isn’t the best — for example it’s
confusing having “named properties” be the abstract properties
associated with an object that can have getter/setters, while calling
the ECMAScript properties that appear on the host object “corresponding
named properties”.  But that can be fixed later.

So for HTMLCollection as it currently stands in the spec, all that would
need to be added is something like the following:

  Objects implementing HTMLCollection have indexed properties with indices
  in the range 0 ≤ key < length.  Such objects also have named properties
  for every name that, if passed to namedItem(), would return a node.



Cameron McCormack ≝ http://mcc.id.au/
Received on Tuesday, 18 November 2008 10:45:30 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:39 UTC