Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #33899
| Path | csiph.com!weretis.net!feeder4.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.100.225.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Inserting a DIV inside another DIV |
| Date | Sun, 27 Aug 2017 16:15:34 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 108 |
| Message-ID | <7368313.T7Z3S40VBb@PointedEars.de> (permalink) |
| References | <f8562d64-82c7-4f5b-832f-4a8e4e7e7f00@googlegroups.com> <XnsA7DA7B81F3EA5eejj99@194.109.6.166> <e8340f56-ccf7-48ef-9662-e5ab7a498476@googlegroups.com> <XnsA7DB5B3E25BD7eejj99@194.109.6.166> <6711ac96-c627-4e0c-b267-6a7602e0cdc5@googlegroups.com> <f0e3hoFs79eU1@mid.individual.net> <5095798.DvuYhMxLoT@PointedEars.de> <f0flsfF8a6fU1@mid.individual.net> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| Injection-Info | gwaiyur.mb-net.net; posting-host="100.225.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch:178.197.225.100"; logging-data="6698"; mail-complaints-to="abuse@open-news-network.org" |
| User-Agent | KNode/4.14.2 |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| X-User-ID | U2FsdGV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headers only | View raw
Peter Flynn wrote:
> On 27/08/17 02:16, Thomas 'PointedEars' Lahn wrote:
>> Peter Flynn wrote:
>>> Doubly confusing because the designer who chose that phrase also didn't
>>> understand this kind of markup — you are correct, one does not "append"
>>> inside an element, one "inserts". One "appends" to a list; if there is
>>> nothing to append to, it makes no sense to use the word "append".
> [snip]
>>
>> Utter nonsense.
>
> I'm afraid not.
You are wrong.
>> By calling the appendChild() method of an element object, one appends a
>> child node to the list of child nodes of an element node,
>
> Right, no disagreement there. But what if there are no child nodes?
Then the list of child nodes is *empty*, and the referred object’s `length`
property has the value `0` (zero).
Borrowing from mathematics (cf. “empty set”), in (theoretical) computer
science the concept of emptiness acquires another and even a different,
counter-intuitive meaning.
For example, according to the theory of formal languages, every character of
the text that you just read (including whitespace) has before and after it
the “empty word” (commonly denoted ε [epsilon]), each of which produces an
“empty string” (a string [of characters] of length zero, and indeed a String
object with a `length` property value of `0`) as *match* when the ECMAScript
regular expression (and in this case, also PCRE) `(?:)` is matched against
the text as a String value:
text.match(/(?:)/g)
For another example (as you should know if you knew what you claimed you
know), the *content* model of certain elements of certain markup languages
is *empty* (SGML/XML: `EMPTY`). Colloquially this is a contradiction in
terms, but it makes perfect sense in computer science because those
languages *are* formal languages.
> My point is that the choice of *name* for the method is misleading in
> that circumstance.
No, it is not. The node is *always* appended to, i.e. it is inserted *at
the end* of, the list of child nodes.
In computer science, inserting an element at the end of an empty list means
to modify that list so that afterwards it contains only the inserted
element(s), in insertion order.
Moreover, if you append a node as child node to an element that already is a
child node of the same element, it is moved towards the end of the list of
child nodes (i.e. to the end of the target element). If it is already the
child node of another element, it is moved from that element to the end of
the target element. This is an easy and efficient way to rearrange child
elements, for example for sorting a table [the recommendation is to sort the
list as an Array first, then append each child element to the node list in
array element order:
[].slice.call(tBody.rows).sort((row1, row2) => …)
.forEach((row) => tBody.appendChild(row));
].
> "Insert" is the normal name for this action (see the
> menus of any XML editor).
No, an insertion into a list can happen at *any* position of the list (cf.
“insertion sort”). Appending something is a *special* kind of insertion *at
the end* (from Latin «appendēre» “to hang up”, “to suspend”, “to pay out”;
cf. “appendix” etc.)
<https://en.wikipedia.org/wiki/Append>
That is why
el.insertBefore(child, el.lastChild);
is equivalent to
el.appendChild(child);
[If the element node has no child nodes, el.lastChild is `null`, and
el.insertBefore() is specified and implemented to handle that, so this is
safe in all cases.]
<https://www.w3.org/TR/2015/REC-dom-20151119/#dom-node-insertbefore>
> > Sadly, you have not the slightest clue what you are talking about.
>
> Oh dear.
Q.E.D.
>> To begin with, there is no “Javascript” (see sig).
>
> *plonk*
LOL. So you have not read my sig and are out of arguments already?
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Inserting a DIV inside another DIV bit-naughty@hotmail.com - 2017-08-22 21:47 -0700
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-23 12:08 +0200
Re: Inserting a DIV inside another DIV bit-naughty@hotmail.com - 2017-08-23 23:19 -0700
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-24 08:58 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-08-24 08:55 +0100
Re: Inserting a DIV inside another DIV bit-naughty@hotmail.com - 2017-08-24 23:16 -0700
Re: Inserting a DIV inside another DIV tony@mountifield.org (Tony Mountifield) - 2017-08-25 09:04 +0000
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-25 15:54 +0100
Re: Inserting a DIV inside another DIV bit-naughty@hotmail.com - 2017-08-27 23:43 -0700
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-28 11:04 +0100
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-08-28 04:02 -0700
Re: Inserting a DIV inside another DIV "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-28 06:24 -0700
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-08-28 07:42 -0700
Re: Inserting a DIV inside another DIV "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-29 06:45 -0700
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-28 15:13 +0100
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-08-28 07:30 -0700
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-29 10:11 +0100
Re: Inserting a DIV inside another DIV "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-29 07:00 -0700
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-30 18:24 +0100
Re: Inserting a DIV inside another DIV "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-29 06:57 -0700
Re: Inserting a DIV inside another DIV "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-08-29 06:51 -0700
Re: Inserting a DIV inside another DIV bit-naughty@hotmail.com - 2017-09-02 11:18 -0700
Re: Inserting a DIV inside another DIV Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2017-09-11 19:57 -0300
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-09-12 05:30 -0700
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-12 14:37 +0200
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-09-12 06:15 -0700
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-12 15:44 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-09-12 14:51 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-12 16:38 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-09-12 20:20 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-09-13 18:47 +0200
Re: Inserting a DIV inside another DIV Joao Rodrigues <groups_jr-1@yahoo.com> - 2017-09-13 01:20 -0300
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-25 14:33 +0200
Re: Inserting a DIV inside another DIV Peter Flynn <peter@silmaril.ie> - 2017-08-26 21:21 +0100
Re: Inserting a DIV inside another DIV Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 03:16 +0200
Re: Inserting a DIV inside another DIV Peter Flynn <peter@silmaril.ie> - 2017-08-27 11:40 +0100
Re: Inserting a DIV inside another DIV Julio Di Egidio <julio@diegidio.name> - 2017-08-27 04:05 -0700
Re: Inserting a DIV inside another DIV Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 16:15 +0200
Re: Inserting a DIV inside another DIV Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-08-27 16:27 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-08-27 15:42 +0100
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-27 14:10 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-27 15:40 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-28 10:50 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-28 22:35 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-08-28 22:53 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-29 00:27 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-29 10:16 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-29 23:05 +0200
Re: Inserting a DIV inside another DIV Tim Streater <timstreater@greenbee.net> - 2017-08-29 22:51 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-30 00:29 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-30 16:33 +0100
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-29 09:57 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-29 18:05 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-30 16:33 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-30 21:43 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-31 10:08 +0100
Re: Inserting a DIV inside another DIV "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-31 16:40 +0200
Re: Inserting a DIV inside another DIV John G Harris <niam@jghnorth.org.uk.invalid> - 2017-08-31 18:37 +0100
csiph-web