A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

Difference between revisions of "IDL"

From WHATWG Wiki
Jump to: navigation, search
(sequence vs [])
([])
 
Line 9: Line 9:
 
** The returned object is not a JavaScript Array.
 
** The returned object is not a JavaScript Array.
 
** If the returned object is declared readonly it can still be manipulated by the browser, unlike a frozen JavaScript Array.
 
** If the returned object is declared readonly it can still be manipulated by the browser, unlike a frozen JavaScript Array.
** In general this is probably better avoided. There's a desire expressed to kill [].
+
* In general this is probably better avoided. There's a desire expressed to kill [] and only use JavaScript Arrays.
  
 
[[Category:Spec_coordination]]
 
[[Category:Spec_coordination]]

Latest revision as of 19:12, 10 July 2013

sequence

  • As return value always returns a new JavaScript Array.
  • Better than [] for methods and dictionaries taking arrays.

[]

  • When a method returns a [] it either returns a new copy or the same.
    • The returned object is not a JavaScript Array.
    • If the returned object is declared readonly it can still be manipulated by the browser, unlike a frozen JavaScript Array.
  • In general this is probably better avoided. There's a desire expressed to kill [] and only use JavaScript Arrays.