W3C home > Mailing lists > Public > public-xformsusers@w3.org > December 2016

Re: insert and delete

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Wed, 14 Dec 2016 09:42:01 +0100
To: "public-xformsusers@w3.org" <public-xformsusers@w3.org>, "Steven Pemberton" <steven.pemberton@cwi.nl>
Message-ID: <op.ysgc4b0ssmjzpq@steven-aspire-s7>
OK, so I made the agreed change that insert and delete do not insert and  
delete if the index is out of bounds, but the question arises: fail  
silently, or dispatch an event?

Any feelings?

Steven

On Tue, 22 Nov 2016 21:23:38 +0100, Steven Pemberton  
<steven.pemberton@cwi.nl> wrote:

> Insert and delete are symmetrical:
>
> If you try to insert with a value of @at below 1, it inserts at the  
> start; with a value larger than the size of the sequence, or with  
> something that isn't a number, it inserts at the end.
>
> <instance>
>    <data xmlns="">
>      <list>
>         <item/>
>         <item/>
>         <item/>
>      </list>
>      <node/>
>    </data>
> </instance>
> ...
> <insert context="list" ref="item" at="-100" origin="node"/> - inserts at  
> start
> <insert context="list" ref="item" at="100" origin="node"/> - inserts at  
> end
> <insert context="list" ref="item" at="cat" origin="node"/> - inserts at  
> end
>
> Delete works the same.
>
> <delete context="list" ref="item" at="-100"/> - deletes first item
> <delete context="list" ref="item" at="100"/> - deletes last item
> <delete context="list" ref="item" at="cat"/> - deletes last item
>
> Now, I'm OK with how insert works. It does a best effort.
>
> However, I'm less happy with deleting when @at is out-of-range, since  
> you are losing information.
>
> Personally I'd prefer delete only to delete items if @at is in range.
>
> Steven
Received on Wednesday, 14 December 2016 08:42:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:37:47 UTC