1、Information technology Programming languages, their environments and system software interfaces ECMAScript language specificationCAN/CSA-ISO/IEC 16262:13(ISO/IEC 16262:2011, IDT)National Standard of CanadaNOT FOR RESALE. / PUBLICATION NON DESTINE LA REVENTE.Legal Notice for StandardsCanadian Standar
2、ds Association (operating as “CSA Group”) develops standards through a consensus standards development process approved by the Standards Council of Canada. This process brings together volunteers representing varied viewpoints and interests to achieve consensus and develop a standard. Although CSA G
3、roup administers the process and establishes rules to promote fairness in achieving consensus, it does not independently test, evaluate, or verify the content of standards.Disclaimer and exclusion of liabilityThis document is provided without any representations, warranties, or conditions of any kin
4、d, express or implied, including, without limitation, implied warranties or conditions concerning this documents fitness for a particular purpose or use, its merchantability, or its non-infringement of any third partys intellectual property rights. CSA Group does not warrant the accuracy, completene
5、ss, or currency of any of the information published in this document. CSA Group makes no representations or warranties regarding this documents compliance with any applicable statute, rule, or regulation. IN NO EVENT SHALL CSA GROUP, ITS VOLUNTEERS, MEMBERS, SUBSIDIARIES, OR AFFILIATED COMPANIES, OR
6、 THEIR EMPLOYEES, DIRECTORS, OR OFFICERS, BE LIABLE FOR ANY DIRECT, INDIRECT, OR INCIDENTAL DAMAGES, INJURY, LOSS, COSTS, OR EXPENSES, HOWSOEVER CAUSED, INCLUDING BUT NOT LIMITED TO SPECIAL OR CONSEQUENTIAL DAMAGES, LOST REVENUE, BUSINESS INTERRUPTION, LOST OR DAMAGED DATA, OR ANY OTHER COMMERCIAL O
7、R ECONOMIC LOSS, WHETHER BASED IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR ANY OTHER THEORY OF LIABILITY, ARISING OUT OF OR RESULTING FROM ACCESS TO OR POSSESSION OR USE OF THIS DOCUMENT, EVEN IF CSA GROUP HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, INJURY, LOSS, COSTS, OR EXPENSES.In publ
8、ishing and making this document available, CSA Group is not undertaking to render professional or other services for or on behalf of any person or entity or to perform any duty owed by any person or entity to another person or entity. The information in this document is directed to those who have th
9、e appropriate degree of experience to use and apply its contents, and CSA Group accepts no responsibility whatsoever arising in any way from any and all use of or reliance on the information contained in this document. CSA Group is a private not-for-profit company that publishes voluntary standards
10、and related documents. CSA Group has no power, nor does it undertake, to enforce compliance with the contents of the standards or other documents it publishes. Intellectual property rights and ownershipAs between CSA Group and the users of this document (whether it be in printed or electronic form),
11、 CSA Group is the owner, or the authorized licensee, of all works contained herein that are protected by copyright, all trade-marks (except as otherwise noted to the contrary), and all inventions and trade secrets that may be contained in this document, whether or not such inventions and trade secre
12、ts are protected by patents and applications for patents. Without limitation, the unauthorized use, modification, copying, or disclosure of this document may violate laws that protect CSA Groups and/or others intellectual property and may give rise to a right in CSA Group and/or others to seek legal
13、 redress for such use, modification, copying, or disclosure. To the extent permitted by licence or by law, CSA Group reserves all intellectual property rights in this document.Patent rightsAttention is drawn to the possibility that some of the elements of this standard may be the subject of patent r
14、ights. CSA Group shall not be held responsible for identifying any or all such patent rights. Users of this standard are expressly advised that determination of the validity of any such patent rights is entirely their own responsibility.Authorized use of this documentThis document is being provided
15、by CSA Group for informational and non-commercial use only. The user of this document is authorized to do only the following:If this document is in electronic form:sLOADTHISDOCUMENTONTOACOMPUTERFORTHESOLEPURPOSEOFREVIEWINGITsSEARCHANDBROWSETHISDOCUMENTANDsPRINTTHISDOCUMENTIFITISIN0$ this remains the
16、 continuing responsibility of the SDO. An NSC reflects a consensus of a number of capable individuals whose collective interests provide, to the greatest practicable extent, a balance of representation of general interests, producers, regulators, users (including consumers), and others with relevant
17、 interests, as may be appropriate to the subject in hand. It normally is a standard which is capable of making a significant and timely contribution to the national interest.Those who have a need to apply standards areencouraged to use NSCs. These standards are subjectto periodic review. Users of NS
18、Cs are cautionedto obtain the latest edition from the SDO which publishes the standard.The responsibility for approving standards as National Standards of Canada rests with theStandards Council of Canada270 Albert Street, Suite 200Ottawa, Ontario, K1P 6N7CanadaAlthough the intended primary applicati
19、on of this Standard is stated in its Scope, it is importantto note that it remains the responsibility of the users to judge its suitability for their particular purpose.Registered trade-mark of Canadian Standards AssociationCette norme est offerte en anglais seulement pour le moment. Le Groupe CSA p
20、ubliera la versionen franais ds quelle sera produite par lorganisme rdacteur.TMA trade-mark of the Canadian Standards Association, operating as “CSA Group”National Standard of CanadaPublished in January 2013 by CSA GroupA not-for-profit private sector organization5060 Spectrum Way, Suite 100, Missis
21、sauga, Ontario, Canada L4W 5N61-800-463-6727 416-747-4044Visit our Online Store at shop.csa.caApproved byStandards Council of CanadaCAN/CSA-ISO/IEC 16262:13Information technology Programming languages, their environments and system software interfaces ECMAScript language specificationPrepared by Int
22、ernationalOrganizationforStandardization/ International Electrotechnical CommissionReviewed byCAN/CSA-ISO/IEC 16262:13Information technology Programminglanguages, their environments and system softwareinterfaces ECMAScript language specificationCSA/4 2013 CSA Group January 2013CAN/CSA-ISO/IEC 16262:
23、13Information technology Programming languages, their environments and system software interfaces ECMAScript language specificationCSA PrefaceStandards development within the Information Technology sector is harmonized with international standards development. Through the CSA Technical Committee on
24、Information Technology (TCIT), Canadians serve as the Canadian Advisory Committee (CAC) on ISO/IEC Joint Technical Committee 1 on Information Technology (ISO/IEC JTC1) for the Standards Council of Canada (SCC), the ISO member body for Canada and sponsor of the Canadian National Committee of the IEC.
25、 Also, as a member of the International Telecommunication Union (ITU), Canada participates in the International Telegraph and Telephone Consultative Committee (ITU-T).This Standard supersedes CAN/CSA-ISO/IEC 16262-04 (adoption of ISO/IEC 16262:2002).At the time of publication, ISO/IEC 16262:2011 is
26、available from ISO and IEC in English only. CSA Group will publish the French version when it becomes available from ISO and IEC.This International Standard was reviewed by the TCIT under the jurisdiction of the Strategic Steering Committee on Information Technology and deemed acceptable for use in
27、Canada. From time to time, ISO/IEC may publish addenda, corrigenda, etc. The TCIT will review these documents for approval and publication. For a listing, refer to the Current Standards Activities page at standardsactivities.csa.ca. This Standard has been formally approved, without modification, by
28、the Technical Committee and has been approved as a National Standard of Canada by the Standards Council of Canada. 2013 CSA GroupAll rights reserved. No part of this publication may be reproduced in any form whatsoever without the prior permission of thepublisher. ISO/IEC material is reprinted with
29、permission. Where the words “this International Standard” appear in the text, they should be interpreted as “this National Standard of Canada”.Inquiries regarding this National Standard of Canada should be addressed toCSA Group5060 Spectrum Way, Suite 100, Mississauga, Ontario, Canada L4W 5N61-800-4
30、63-6727 416-747-4000http:/csa.caTo purchase standards and related publications, visit our Online Store at shop.csa.ca or call toll-free 1-800-463-6727 or 416-747-4044.This Standard is subject to periodic review, and suggestions for its improvement will be referred to the appropriate committee. To su
31、bmit a proposal for change, please send the following information to inquiriescsagroup.org and include “Proposal for change” in the subject line:(a) Standard designation (number);(b) relevant clause, table, and/or figure number;(c) wording of the proposed change; and(d) rationale for the change.Refe
32、rence numberISO/IEC 16262:2011(E)ISO/IEC 2011INTERNATIONAL STANDARD ISO/IEC16262Third edition2011-06.15Information technology Programming languages, their environments and system software interfaces ECMAScript language specification Technologies de linformation Langages de programmation, leurs envir
33、onnements et interfaces de logiciel systme Spcification du langage ECMAscript ISO/IEC 16262:2011(E) COPYRIGHT PROTECTED DOCUMENT ISO/IEC 2011 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanic
34、al, including photocop ying and microfilm, without permission in writing from either ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail copyrightiso.org Web www.iso.o
35、rg ii ISO/IEC 2011 All rights reservedISO/IEC 16262:2011(E) ISO/IEC 2011 All rights reserved iiiContents Page Foreword.viii Introduction.ix 1 Scope.1 2 Conformance.1 3 Normative references.1 4 Overview1 4.1 Web Scripting2 4.2 Language Overview2 4.2.1 Objects.3 4.2.2 The Strict Variant of ECMAScript4
36、 4.3 Terms and definitions.4 5 Notational Conventions8 5.1 Syntactic and Lexical Grammars.8 5.1.1 Context-Free Grammars.8 5.1.2 The Lexical and RegExp Grammars8 5.1.3 The Numeric String Grammar8 5.1.4 The Syntactic Grammar8 5.1.5 The JSON Grammar9 5.1.6 Grammar Notation9 5.2 Algorithm Conventions12
37、6 Source Text.13 7 Lexical Conventions.14 7.1 Unicode Format-Control Characters.14 7.2 White Space.15 7.3 Line Terminators.15 7.4 Comments.16 7.5 Tokens.17 7.6 Identifier Names and Identifiers.17 7.6.1 Reserved Words18 7.7 Punctuators.19 7.8 Literals.20 7.8.1 Null Literals.20 7.8.2 Boolean Literals2
38、0 7.8.3 Numeric Literals20 7.8.4 String Literals22 7.8.5 Regular Expression Literals.25 7.9 Automatic Semicolon Insertion.26 7.9.1 Rules of Automatic Semicolon Insertion26 7.9.2 Examples of Automatic Semicolon Insertion27 8 Types.28 8.1 The Undefined Type28 8.2 The Null Type28 8.3 The Boolean Type.2
39、9 8.4 The String Type.29 8.5 The Number Type29 8.6 The Object Type30 8.6.1 Property Attributes.30 8.6.2 Object Internal Properties and Methods.31 ISO/IEC 16262:2011(E) iv ISO/IEC 2011 All rights reserved8.7 The Reference Specification Type.35 8.7.1 GetValue (V).35 8.7.2 PutValue (V, W).36 8.8 The Li
40、st Specification Type36 8.9 The Completion Specification Type.36 8.10 The Property Descriptor and Property Identifier Specification Types37 8.10.1 IsAccessorDescriptor ( Desc ).37 8.10.2 IsDataDescriptor ( Desc )37 8.10.3 IsGenericDescriptor ( Desc )37 8.10.4 FromPropertyDescriptor ( Desc ).38 8.10.
41、5 ToPropertyDescriptor ( Obj )38 8.11 The Lexical Environment and Environment Record Specification Types39 8.12 Algorithms for Object Internal Methods39 8.12.1 GetOwnProperty (P).39 8.12.2 GetProperty (P).39 8.12.3 Get (P).39 8.12.4 CanPut (P).39 8.12.5 Put ( P, V, Throw ).40 8.12.6 HasProperty (P)4
42、0 8.12.7 Delete (P, Throw)41 8.12.8 DefaultValue (hint)41 8.12.9 DefineOwnProperty (P, Desc, Throw).41 9 Type Conversion and Testing43 9.1 ToPrimitive43 9.2 ToBoolean.43 9.3 ToNumber43 9.3.1 ToNumber Applied to the String Type.44 9.4 ToInteger46 9.5 ToInt32: (Signed 32 Bit Integer).47 9.6 ToUint32:
43、(Unsigned 32 Bit Integer)47 9.7 ToUint16: (Unsigned 16 Bit Integer)47 9.8 ToString.48 9.8.1 ToString Applied to the Number Type.48 9.9 ToObject49 9.10 CheckObjectCoercible49 9.11 IsCallable.49 9.12 The SameValue Algorithm50 10 Executable Code and Execution Contexts50 10.1 Types of Executable Code50
44、10.1.1 Strict Mode Code.51 10.2 Lexical Environments.51 10.2.1 Environment Records.51 10.2.2 Lexical Environment Operations.56 10.2.3 The Global Environment.56 10.3 Execution Contexts.56 10.3.1 Identifier Resolution.57 10.4 Establishing an Execution Context.57 10.4.1 Entering Global Code.58 10.4.2 E
45、ntering Eval Code.58 10.4.3 Entering Function Code.58 10.5 Declaration Binding Instantiation59 10.6 Arguments Object.60 11 Expressions.63 11.1 Primary Expressions63 11.1.1 The this Keyword63 11.1.2 Identifier Reference.63 11.1.3 Literal Reference.63 11.1.4 Array Initialiser63 ISO/IEC 16262:2011(E) I
46、SO/IEC 2011 All rights reserved v11.1.5 Object Initialiser65 11.1.6 The Grouping Operator67 11.2 Left-Hand-Side Expressions67 11.2.1 Property Accessors67 11.2.2 The new Operator68 11.2.3 Function Calls.68 11.2.4 Argument Lists69 11.2.5 Function Expressions.69 11.3 Postfix Expressions69 11.3.1 Postfi
47、x Increment Operator70 11.3.2 Postfix Decrement Operator.70 11.4 Unary Operators70 11.4.1 The delete Operator70 11.4.2 The void Operator71 11.4.3 The typeof Operator71 11.4.4 Prefix Increment Operator71 11.4.5 Prefix Decrement Operator72 11.4.6 Unary + Operator72 11.4.7 Unary - Operator72 11.4.8 Bit
48、wise NOT Operator ( ).72 11.4.9 Logical NOT Operator ( ! ).73 11.5 Multiplicative Operators.73 11.5.1 Applying the * Operator.73 11.5.2 Applying the / Operator.74 11.5.3 Applying the % Operator.74 11.6 Additive Operators75 11.6.1 The Addition operator ( + ).75 11.6.2 The Subtraction Operator ( - ).7
49、5 11.6.3 Applying the Additive Operators to Numbers.75 11.7 Bitwise Shift Operators76 11.7.1 The Left Shift Operator ( )76 11.7.3 The Unsigned Right Shift Operator ( )77 11.8 Relational Operators.77 11.8.1 The Less-than Operator ( )78 11.8.3 The Less-than-or-equal Operator ( = )78 11.8.5 The Abstract Relation
copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1