Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Flynn Newsgroups: comp.lang.javascript Subject: Re: Inserting a DIV inside another DIV Date: Sat, 26 Aug 2017 21:21:12 +0100 Organization: Usenet Labs Bozon Detector Facility Lines: 56 Message-ID: References: <6711ac96-c627-4e0c-b267-6a7602e0cdc5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net gL+FmOaVyhBt3jfskwpXlA3I2voiXLt+5x50vr01+m3Asr0tCE Cancel-Lock: sha1:/+s2BEUo6X0NBZkfVXa0/yKuVgw= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: <6711ac96-c627-4e0c-b267-6a7602e0cdc5@googlegroups.com> Content-Language: en-US Xref: csiph.com comp.lang.javascript:33883 On 25/08/17 07:16, bit-naughty@hotmail.com wrote: [snip] > Umm *bro*, if one should call you that, it's the "appending it INSIDE" part that confuzzles me: Yes, it's confusing if you don't understand this kind of markup. 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 touse the word "append". But we're stuck with it, I'm afraid. Moral of the story if that designers of languages need to read the spec and understand the structure and syntax of the data they are planning to deal with. [snip] > I find that very confusing - you're calling something INSIDE div2 , > instead of div2 being an *argument*!! I would have thought that if > you want something inside "div", you tell it 1) what you want, and 2) > inside what, i.e. BOTH of them would be arguments. ...Me not the OOP > fanatic, remember....? THAT's the main reason for all the > questions..... That's part of the flawed syntax of Javascript, unfortunately. Essentially, you are right: 1. position yourself (your memory pointer, location, whatever you call it) INSIDE the element you want to insert into, in the desired location with respect to any existing subelements that may exist; 2. perform an INSERT instruction > Why did they do it this way (if, indeed, they have), out of > curiosity? You can see why the designer believed that this should be called "append", because s/he never considered the case[s] where you might want to insert an element inside another, at a location BEFORE any existing subelements; or BETWEEN two existing subelements. S/he only considered the case of adding to the end of the existing subelements, and ignored the case where the containing element was actually empty. Basically, if you don't understand this kind of nested markup, you shouldn't be designing a language that deals with it. In dealing with SGML/HTML/XML you need to think like a tree, not like a chainsaw. ///Peter -- XML FAQ: http://xml.silmaril.ie/