This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
sequence<T> has undesirable behaviour in JS when used as an attribute value, so we should consider preventing its use there.
Would be good to have a recommended alternative to (e.g. a note saying to have a method return that type instead).
Done: http://dev.w3.org/cvsweb/2006/webapi/WebIDL/Overview.xml.diff?r1=1.270;r2=1.271;f=h
(In reply to comment #0) > sequence<T> has undesirable behaviour in JS when used as an attribute value, so > we should consider preventing its use there. Just curious, what that undesirable behavior is? Is it that JS can modify the array while native code is using it?
The undesirable behaviour is that a new Array object would be created every time you access the property. Simple looping over a sequence attribute, like interface Blah { readonly attribute sequence<long> numbers; }; for (var i = 0; i < myBlah.numbers.length; i++) { doSomethingWith(myBlah.numbers[i]); } would end up doing a lot of wasted work.