More string indexing semantics issues
Maciej Stachowiak
mjs at apple.com
Wed Jun 25 01:25:23 PDT 2008
On Jun 24, 2008, at 11:45 PM, Garrett Smith wrote:
>
> Webkit seems to have implemented a specialized [[Put]] for strings.
> When the property is numeric, the property setting fails silently.
> This can be observed by an example:-
>
> javascript:(function(){var a = new String("Alan"); a[0] = "E";
> alert(a[0]); })();
>
> FF2: "E"
> Sf3: "A"
> OP9: "E"
> IE7: "E"
>
> It seems to me that Webkit's behavior is a bug.
We could easily change this, but why do you think the behavior is a
bug (other than not matching Firefox)? Your blog post did not state a
reason either.
My expectation would be that numeric index properties of a String
object are read-only, much like the length property. For example, the
following gives 3 in both Safari and Firefox:
<script>
var s = new String("abc");
s.length = 55;
alert(s.length);
</script>
Regards,
Maciej
More information about the Es4-discuss
mailing list