Re: Contacts API -- pref

Andreas Gal wrote:
> [NoInterfaceObject]
> interface
> ContactField
>   {
>
>      attribute DOMString  type;
>      attribute DOMString? value;
>      attribute boolean pref;
> };
>
> Several classes have a pref attribute that is defined as follows:
>
> pref of type boolean
> This attribute indicates whether this instance of the ContactField is the preferred, or primary, value for the contact property this ContactField is representing in the Contact interface. By default, the value is false.
>
> I don't think the spec explains what happens if multiple entries have that boolean set, or none.

The spec stays silent on that. There's no special behavior attached to 
the pref attribute.

>
> Also, I wonder if the simple order of appearance might be a sufficient way to specify preference (maybe users want a different display order and preference order?).

Currently all major browsers loop over the properties of an object in 
the order in which they were defined. Chrome does this as well, except 
for a couple cases [1]. So there's potential for fragmentation on this. 
ECMA stays silent on the subject of ordering in these cases. ECMA-262 
section 12.6.4 "The for-in Statement" says: "[t]he mechanics and order 
of enumerating the properties [...] is not specified". Relying on that 
ordering seems impossible based on that.

[1] http://code.google.com/p/chromium/issues/detail?id=883

- Rich

Received on Thursday, 25 August 2011 09:30:32 UTC