You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Patrick Mueller (Commented) (JIRA)" <ji...@apache.org> on 2012/01/05 15:29:39 UTC
[jira] [Commented] (CB-155) localStorage does not work with square
brace notation
[ https://issues.apache.org/jira/browse/CB-155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13180424#comment-13180424 ]
Patrick Mueller commented on CB-155:
------------------------------------
Don't know if WP7 has any tricks up it's sleeve, but as far as I know with JSC and V8, there's no way to "simulate" array accessors like this. The alternative is for folks to code to the alternate APIs, listed here: https://developer.mozilla.org/en/DOM/Storage ; specifically:
interface Storage {
DOMString key(in unsigned long index);
DOMString getItem(in DOMString key);
void setItem(in DOMString key, in DOMString data);
void removeItem(in DOMString key);
}
Note, this still leaves the "length" attribute, which it may be possible to fake with a "getter" property, via Object.defineProperty():
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/defineProperty
Usage of Object.__defineGetter__()/__defineSetter__() instead of defineProperty() is probably best avoided, unless that's the only way we can do it with WP7.
> localStorage does not work with square brace notation
> -----------------------------------------------------
>
> Key: CB-155
> URL: https://issues.apache.org/jira/browse/CB-155
> Project: Apache Callback
> Issue Type: Bug
> Components: WP7
> Affects Versions: 1.3.0
> Reporter: Colin Eberhardt
> Assignee: Jesse MacFadyen
>
> Currently the WP7 localStorage shim works if you use localStorage setItem / getItem methods, however, it fails if you use the square brace notation:
> localStorage["key"] = someValue;
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira