This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Warning: E4X已经过时.从Firefox 17开始,E4X在普通网页中被默认禁用,从Firefox 20开始,E4X在浏览器界面中被默认禁用,从Firefox 21开始,E4X被完全删除.使用DOMParser/DOMSerializer或者其他算法来代替.
E4X is standardized by Ecma International in ECMA-357 standard (currently in its second edition, December 2005).
<!--...-->) are ignored for backwards compatibility with the comment hiding trick, and CDATA sections (
<![CDATA[...]]>) are not parsed as CDATA literals (which leads to a JS syntax error in HTML since HTML's
<script>element produces an implicit CDATA section, and therefore cannot contain explicit CDATA sections).
someone verify the above
- It is not currently possible to access a DOM object through E4X (bug 270553)
- E4X doesn't support parsing XML declaration (
- <?xml version=...?>) (see bug 336551). You may get SyntaxError "xml is a reserved identifier" (despite the XML being in a string).
var response = xmlhttprequest.responseText; // bug 270553 response = response.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 var e4x = new XML(response);
- E4X Tutorial Processing XML with E4X on MDN.
- E4X for templating
- See the list of E4X-related pages on MDN:
- ECMA-357 standard
- Brendan's presentation
- E4X at faqts.com
- E4X quick reference at rephrase.net