Re: [css-houdini-drafts] [css-typed-om-1] Is it intentional that only existing items in a CSSUnparsedValue can be mutated?

Your typical nullable-supporting indexed getter looks something like this:

    getter Node? item(unsigned long index);

That means it can be invoked as `foo[5]` or `foo.item(5)`.

When invoked as `foo[5]` the getter operation is never even called, and undefined is returned, if 5 is out of range.

When invoked as `foo.item(5)` the operation is explicitly invoked and the fact that it's a getter is not even relevant.  It just needs to return whatever type it returns given the input value and it's common to return null on out-of-bounds.

In your case, since your getters are identifier-less, you don't need to worry about the direct call case and can assume you will always be invoked with in-range indices.

-- 
GitHub Notification of comment by bzbarsky
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/664#issuecomment-366070166 using your GitHub account

Received on Thursday, 15 February 2018 21:38:48 UTC