This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 11269 - Evaluating keyPaths needs to be better specified
Summary: Evaluating keyPaths needs to be better specified
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
: 9832 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-09 00:38 UTC by Jonas Sicking (Not reading bugmail)
Modified: 2015-04-09 21:51 UTC (History)
4 users (show)

See Also:


Attachments

Description Jonas Sicking (Not reading bugmail) 2010-11-09 00:38:52 UTC
This bug is very similar to bug 9832, however since that bug is discussing a lot of related issues, I wanted to file a separate one to make sure this isn't forgotten.

Currently the syntax for parsing a keyPath isn't explicitly defined. It is clear that for keypath/object

"foo.bar.baz"
{ foo: { bar: { baz: 4 } } }

the result is 4. However does keypath/object

"foo[1].bar"
{ foo: [ false, { bar: 4 }, true ] }

evaluate to 4? What about

"foo[x].bar"
{ foo: [ { bar: 4 } ], x: 0 }

or

""
4

Do either of those evaluate to 4? The last example could be useful when out-of-line keys are used, but still wanting to be able to search on the stored value.
Comment 1 Jonas Sicking (Not reading bugmail) 2010-11-09 01:03:42 UTC
A couple of more keypath/object edge cases that needs to be defined:

"foo[1]"
{ foo: [12, 13] }

"foo[5]"
{ foo: [12, 13] }

"foo.1"
{ foo: [12, 13] }  (i.e. is this a syntax error or not?)

"[1]"
[12, 13]
Comment 2 Jeremy Orlow 2011-03-31 18:27:02 UTC
We decided on this in some thread:

<identifier> ["." <identifier>]*

Where identifier is basically a JavaScript identifier (which I believe is something like this:

[a-zA-Z_][a-zA-Z0-9_]*

But I'm hoping we can avoid speccing this later part ourselves.
Comment 3 Jeremy Orlow 2011-03-31 18:27:21 UTC
*** Bug 9832 has been marked as a duplicate of this bug. ***