[英]Are there any syntactic differences between ECMA-262 and ECMA-357?
There is a number of syntax extensions. 有许多语法扩展。 The most important one are the XML literals (see section 11.1.4 and 11.1.5):
最重要的是XML文字(参见第11.1.4节和第11.1.5节):
var foo = <xml>
foo
</xml>;
var bar = <>
<tag attr={(1+2).toFixed(2)}/>
{foo}
</>;
The example above shows the special case of an empty root tag and JavaScript expressions in XML code. 上面的示例显示了XML代码中空根标记和JavaScript表达式的特殊情况。
You also have some expressions that aren't valid in ECMA-262 (see section 11.2): 您还有一些在ECMA-262中无效的表达式(请参阅第11.2节):
xml.@attr // get attribute attr
xml.* // get all child elements
xml.@* // get all attributes
xml..foo // get all <foo> tags
xml..foo.(@id == 1) // filter <foo> tags by id attribute
There are namespaces (see section 11.1.2): 有命名空间(见第11.1.2节):
xml.soap::foo // get <foo> child tags with namespace soap
xml.@soap::attr // get attribute with namespace soap
There is the default XML namespace statement which is syntactically a very unusual construct (see section 12.1): 有一个默认的XML命名空间语句,它在语法上是一个非常不寻常的构造(参见12.1节):
default xml namespace = new Namespace("http://foo/bar");
Finally, there is the for each .. in
loop which is similar to for .. in
(see section 12.3): 最后,
for each .. in
循环都有类似于for .. in
(参见12.3节):
for each (var foo in xml)
{
}
As far as I know these are all the syntax differences - but you've probably got more than enough already. 据我所知,这些都是语法差异 - 但你可能已经绰绰有余了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.