Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.straub-nv.de!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <2407693.BvehyK1eGy@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Mon, 04 Feb 2013 02:35:12 +0100 User-Agent: KNode/4.8.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. text replacement ?? Newsgroups: comp.lang.javascript References: <5418755.GafWFG2uKG@PointedEars.de> MIME-Version: 1.0 Lines: 46 NNTP-Posting-Date: 04 Feb 2013 02:35:12 CET NNTP-Posting-Host: d1a4b930.newsspool4.arcor-online.net X-Trace: DXC=0>QSS2ARSiJjl]Vc7 X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.javascript:18337 Christoph Becker wrote: > Thomas 'PointedEars' Lahn wrote: >> Compare the result of >> >> el.textContent = "foo & bar"; >> >> with that of >> >> el.innerHTML = "foo & bar"; > > Or even > > el.textContent = ""; > > vs. > > el.innerHTML = ""; Indeed, blindly assigning to the “innerHTML” property is particularly problematic where the parser implementation is not stable, allows for proprietary extensions, or fragments from other markup languages can be embedded. “g” is the name of an SVG element type [1], and a plain “” tag will be parsed into an HTMLUnknownElement node by an HTML5-compliant parser. The same parser will parse it into an SVGGElement node when it is located within “…”. [It is not possible to accidentally insert HTML elements or to insert SVG elements in an SVG document that way: the corresponding element objects do not have an “innerHTML” property. Assigning to the “innerHTML” property of an SVG element object will either fail with a runtime error or create that String property on that host object, having no other effect.] Tested in Chromium “22.0.1229.94 Built on Debian wheezy/sid, running on Debian 7.0 (161065)”. [1] -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.