Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29077
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: references to DOM parts |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <DOM-20151230191146@ram.dialup.fu-berlin.de> <1etso5kfd39eq$.19v3fhasifklp$.dlg@40tude.net> |
| Date | 2015-12-31 11:11 +0100 |
| Message-ID | <XnsA58171C47E6C6eejj99@194.109.6.166> (permalink) |
JJ <jj4public@vfemail.net> wrote on 31 Dec 2015 in comp.lang.javascript: > On 30 Dec 2015 18:20:39 GMT, Stefan Ram wrote: >> I have an HTML document that starts with >> >> <!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" lang="de" >> xml:lang="de"> <head><meta charset="UTF-8"> >> >> . Now, I define names for parts of the DOM via the JavaScript >> console: >> >> h = this.document.firstElementChild >> hh = h.firstElementChild >> m = hh.firstElementChild >> >> . I perform the following evaluations in the Firefox Console >> (one line is input, the next is output, then this repeats): >> >> m.outerHTML >> "<meta charset="UTF-8">" >> >> m.outerHTML = '<meta charset="ISO-8859-1">' >> "<meta charset="ISO-8859-1">" >> >> m.outerHTML >> "<meta charset="UTF-8">" >> >> hh.firstElementChild.outerHTML >> "<meta charset="ISO-8859-1">" >> >> this.document.firstElementChild.firstElementChild.firstElementChild.oute >> rHTML "<meta charset="ISO-8859-1">" >> >> One can see above that the assigment to »m.outerHTML« >> has the intended effect when one looks at the result via »hh«, >> but when one is looking via »m«, one still sees the old value. >> >> The last evaluation shows that the DOM was really modified. >> Why do I see the new value via »hh«, but not via »m«? > > Assignment to outerHTML property creates a new HTML object and if > succeeded, it replaces the old one. So the m value is not changed. It's > still reference to the old HTML object which is now an orphan element. Would the "var m" assignment not prevent it from being a real orphan [in the sense of gabage-collectable]? ... as it can be reassigned anywhere in the DOM-tree later? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: references to DOM parts JJ <jj4public@vfemail.net> - 2015-12-31 11:47 +0700
Re: references to DOM parts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-31 11:11 +0100
Re: references to DOM parts JJ <jj4public@vfemail.net> - 2015-12-31 21:15 +0700
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2015-12-31 13:35 -0300
Re: references to DOM parts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-12-31 19:19 +0100
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2015-12-31 15:41 -0300
Re: references to DOM parts Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2015-12-31 21:23 -0200
Re: references to DOM parts JJ <jj4public@vfemail.net> - 2016-01-01 06:54 +0700
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-01 03:36 +0100
Re: references to DOM parts Andrew Poulos <ap_prog@hotmail.com> - 2016-01-01 17:30 +1100
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-01 10:31 +0100
Re: references to DOM parts "J.R." <groups_jr-1@yahoo.com.br> - 2016-01-03 00:37 -0800
Re: references to DOM parts Andrew Poulos <ap_prog@hotmail.com> - 2016-01-03 20:10 +1100
Re: references to DOM parts Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-01-03 03:32 -0800
Re: references to DOM parts Mark - <nonemail@spamspamapam.net> - 2016-01-03 14:36 +0000
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2016-01-03 16:55 -0300
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-03 23:47 +0100
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2016-01-03 20:51 -0300
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-04 02:42 +0100
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2016-01-03 23:13 -0300
Re: references to DOM parts Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-01-04 09:07 -0200
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-04 22:17 +0100
Re: references to DOM parts Stefan Weiss <krewecherl@gmail.com> - 2016-01-05 15:36 +0100
Re: references to DOM parts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-05 16:19 +0100
Re: references to DOM parts Tim Streater <timstreater@greenbee.net> - 2016-01-05 18:09 +0000
Re: references to DOM parts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-05 20:13 +0100
Re: references to DOM parts Stefan Weiss <krewecherl@gmail.com> - 2016-01-07 14:02 +0100
Re: references to DOM parts "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-01-07 16:50 +0100
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 18:41 +0100
Re: references to DOM parts John Harris <niam@jghnorth.org.uk.invalid> - 2016-01-07 18:12 +0000
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-07 20:18 +0100
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2016-01-07 18:22 -0300
Re: references to DOM parts John Harris <niam@jghnorth.org.uk.invalid> - 2016-01-08 10:08 +0000
Re: references to DOM parts Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-01-07 18:03 -0800
Re: references to DOM parts Dr J R Stockton <reply1600@merlyn.demon.co.uk.invalid> - 2016-01-04 21:00 +0000
Re: references to DOM parts "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-01-04 16:45 -0800
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-01 03:32 +0100
Re: references to DOM parts Aleksandro <aleksandro@gmx.com> - 2016-01-01 02:56 -0300
Re: references to DOM parts Luuk <luuk@invalid.lan> - 2016-01-03 16:56 +0100
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-03 17:25 +0100
Re: references to DOM parts Luuk <luuk@invalid.lan> - 2016-01-03 18:19 +0100
Re: references to DOM parts Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-01-03 23:23 +0100
Re: references to DOM parts Tim Streater <timstreater@greenbee.net> - 2016-01-03 22:28 +0000
Re: references to DOM parts Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2016-01-04 09:09 -0200
csiph-web