Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30327 > unrolled thread

Is there such a thing as AppendSibling?

Started bybit-naughty@hotmail.com
First post2016-04-25 23:09 -0700
Last post2016-04-30 05:48 -0700
Articles 19 — 9 participants

Back to article view | Back to comp.lang.javascript


Contents

  Is there such a thing as AppendSibling? bit-naughty@hotmail.com - 2016-04-25 23:09 -0700
    Re: Is there such a thing as AppendSibling? Jake Jarvis <pig_in_shoes@yahoo.com> - 2016-04-26 09:01 +0200
      Re: Is there such a thing as AppendSibling? JJ <jj4public@vfemail.net> - 2016-04-26 19:05 +0700
        Re: Is there such a thing as AppendSibling? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-26 17:49 +0200
          Re: Is there such a thing as AppendSibling? JJ <jj4public@vfemail.net> - 2016-04-27 12:14 +0700
            Re: Is there such a thing as AppendSibling? Stefan Weiss <krewecherl@gmail.com> - 2016-04-27 11:28 +0200
              Re: Is there such a thing as AppendSibling? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-27 21:29 +0200
          Re: Is there such a thing as AppendSibling? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-04-27 13:07 +0100
            Re: Is there such a thing as AppendSibling? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-04-27 06:41 -0700
              Re: Is there such a thing as AppendSibling? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-04-27 15:52 +0200
                Re: Is there such a thing as AppendSibling? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-04-27 10:57 -0700
              Re: Is there such a thing as AppendSibling? "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-04-27 16:00 +0200
                Re: Is there such a thing as AppendSibling? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-04-27 10:48 -0700
                Re: Is there such a thing as AppendSibling? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-04-27 20:19 +0100
                  Re: Is there such a thing as AppendSibling? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-27 21:42 +0200
            Re: Is there such a thing as AppendSibling? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-27 21:33 +0200
              Re: Is there such a thing as AppendSibling? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-27 21:44 +0200
                Re: Is there such a thing as AppendSibling? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-04-27 22:30 +0100
      Re: Is there such a thing as AppendSibling? bit-naughty@hotmail.com - 2016-04-30 05:48 -0700

#30327 — Is there such a thing as AppendSibling?

Frombit-naughty@hotmail.com
Date2016-04-25 23:09 -0700
SubjectIs there such a thing as AppendSibling?
Message-ID<f34d1e4b-3958-4635-94bc-3f06c89486bc@googlegroups.com>
I know about AppendChild, but if I say, have a <div> and I want another <div> *next* to it to appear when a particular button is clicked - i.e. _it's at the same level in the DOM tree_ !!! , then what do I do?


Thanks.

[toc] | [next] | [standalone]


#30328

FromJake Jarvis <pig_in_shoes@yahoo.com>
Date2016-04-26 09:01 +0200
Message-ID<nfn3hd$htf$1@dont-email.me>
In reply to#30327
Am 26.04.2016 um 08:09 schrieb bit-naughty@hotmail.com:
> I know about AppendChild, but if I say, have a <div> and I want another <div> *next* to it to appear when a particular button is clicked - i.e. _it's at the same level in the DOM tree_ !!! , then what do I do?
>
>
> Thanks.
>

Go up one level to the parent element and use the insertBefore(newChild, 
refChild) method.

[toc] | [prev] | [next] | [standalone]


#30334

FromJJ <jj4public@vfemail.net>
Date2016-04-26 19:05 +0700
Message-ID<d9u5u561foam.1nkzd11bm9nvy.dlg@40tude.net>
In reply to#30328
On Tue, 26 Apr 2016 09:01:13 +0200, Jake Jarvis wrote:
> Am 26.04.2016 um 08:09 schrieb bit-naughty@hotmail.com:
>> I know about AppendChild, but if I say, have a <div> and I want another <div> *next* to it to appear when a particular button is clicked - i.e. _it's at the same level in the DOM tree_ !!! , then what do I do?
>>
>>
>> Thanks.
>>
> 
> Go up one level to the parent element and use the insertBefore(newChild, 
> refChild) method.

Or insertAdjacentHTML(). Whichever is applicable.

[toc] | [prev] | [next] | [standalone]


#30339

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-04-26 17:49 +0200
Message-ID<2507561.Om0TlvYDvz@PointedEars.de>
In reply to#30334
JJ wrote:

> On Tue, 26 Apr 2016 09:01:13 +0200, Jake Jarvis wrote:
>> Am 26.04.2016 um 08:09 schrieb bit-naughty@hotmail.com:
>>> I know about AppendChild, but if I say, have a <div> and I want another
>>> <div> *next* to it to appear when a particular button is clicked - i.e.
>>> _it's at the same level in the DOM tree_ !!! , then what do I do?
>>> Thanks.
>> Go up one level to the parent element and use the insertBefore(newChild,
>> refChild) method.
> 
> Or insertAdjacentHTML(). Whichever is applicable.

insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it is 
obsolete since IE/MSHTML 5.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#30356

FromJJ <jj4public@vfemail.net>
Date2016-04-27 12:14 +0700
Message-ID<165xttxngz2tw$.153gbq3rd98pc.dlg@40tude.net>
In reply to#30339
On Tue, 26 Apr 2016 17:49:49 +0200, Thomas 'PointedEars' Lahn wrote:
> 
> insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it is 
> obsolete since IE/MSHTML 5.

True, but Chromium and Firefox support it regardless. You should tell them
that.

Efficiency and flawlessness would depend on the implementation, not the
function specifications.

And IE still support it until its last version. Surely you meant Edge
instead of IE?

[toc] | [prev] | [next] | [standalone]


#30360

FromStefan Weiss <krewecherl@gmail.com>
Date2016-04-27 11:28 +0200
Message-ID<nfq0no$fnt$1@news.albasani.net>
In reply to#30356
JJ wrote:
> On Tue, 26 Apr 2016 17:49:49 +0200, Thomas 'PointedEars' Lahn wrote:
>>
>> insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it is 
>> obsolete since IE/MSHTML 5.
> 
> True, but Chromium and Firefox support it regardless. You should tell them
> that.
> 
> Efficiency and flawlessness would depend on the implementation, not the
> function specifications.
> 
> And IE still support it until its last version. Surely you meant Edge
> instead of IE?

Edge and IE both support it (as do all of the other major browsers). I can't
find any indication that this method has ever been marked as obsolete. It
doesn't look particularly inefficient or error-prone to me. Interesting to
see such unsubstantiated claims from someone who frequently insists that
others have to "cite evidence".

- stefan

[toc] | [prev] | [next] | [standalone]


#30371

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-04-27 21:29 +0200
Message-ID<1883569.FeaefMiEB4@PointedEars.de>
In reply to#30360
Stefan Weiss wrote:

> JJ wrote:
>> On Tue, 26 Apr 2016 17:49:49 +0200, Thomas 'PointedEars' Lahn wrote:
>>> insertAdjacentHTML() is proprietary, inefficient, and error-prone; and
>>> it is obsolete since IE/MSHTML 5.
>> 
>> True, but Chromium and Firefox support it regardless. You should tell
>> them that.
>> 
>> Efficiency and flawlessness would depend on the implementation, not the
>> function specifications.
>> 
>> And IE still support it until its last version. Surely you meant Edge
>> instead of IE?
> 
> Edge and IE both support it (as do all of the other major browsers). I
> can't find any indication that this method has ever been marked as
> obsolete.

It is obsolete since IE/MSHTML 5 because IE/MSHTML 5 supports the W3C DOM.  
So do other browsers.

> It doesn't look particularly inefficient or error-prone to me.

Then you should have your eyes checked.  It is eval() and innerHTML in 
disguise: the second argument is a *string* of *markup* that needs to be 
*parsed* first.  Not so with appendChild().

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#30361

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2016-04-27 13:07 +0100
Message-ID<c6e3e$5720ab80$11450e5d$367@nntpswitch.blueworldhosting.com>
In reply to#30339
On 26/04/2016 16:49, Thomas 'PointedEars' Lahn wrote:
> JJ wrote:
>
>> On Tue, 26 Apr 2016 09:01:13 +0200, Jake Jarvis wrote:
>>> Am 26.04.2016 um 08:09 schrieb bit-naughty@hotmail.com:
>>>> I know about AppendChild, but if I say, have a <div> and I want another
>>>> <div> *next* to it to appear when a particular button is clicked - i.e.
>>>> _it's at the same level in the DOM tree_ !!! , then what do I do?
>>>> Thanks.
>>> Go up one level to the parent element and use the insertBefore(newChild,
>>> refChild) method.
>>
>> Or insertAdjacentHTML(). Whichever is applicable.
>
> insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it is
> obsolete since IE/MSHTML 5.

Based on:

* 
https://w3c.github.io/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text
* https://msdn.microsoft.com/en-us/library/ms536452%28v=vs.85%29.aspx
* 
https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML

I don't think so it's obsolete.

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30362

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2016-04-27 06:41 -0700
Message-ID<0d63f4bc-9bd4-4e21-994d-779d667cdb91@googlegroups.com>
In reply to#30361
On Wednesday, April 27, 2016 at 7:07:34 AM UTC-5, Cezary Tomczyk wrote:
> On 26/04/2016 16:49, Thomas 'PointedEars' Lahn wrote:
> > JJ wrote:
> >
> >> On Tue, 26 Apr 2016 09:01:13 +0200, Jake Jarvis wrote:
> >>> Am 26.04.2016 um 08:09 schrieb bit-naughty [...]:
> >>>> I know about AppendChild, but if I say, have a <div> and I want another
> >>>> <div> *next* to it to appear when a particular button is clicked - i.e.
> >>>> _it's at the same level in the DOM tree_ !!! , then what do I do?
> >>>> Thanks.
> >>> Go up one level to the parent element and use the insertBefore(newChild,
> >>> refChild) method.
> >>
> >> Or insertAdjacentHTML(). Whichever is applicable.
> >
> > insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it is
> > obsolete since IE/MSHTML 5.
> 
> Based on:
> 
> * 
> https://w3c.github.io/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text
> * https://msdn.microsoft.com/en-us/library/ms536452%28v=vs.85%29.aspx
> * 
> https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
> 
> I don't think so it's obsolete.

Don't reference a Draft if you are making an argument about what is standard.

<https://www.w3.org/TR/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text>

[toc] | [prev] | [next] | [standalone]


#30363

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2016-04-27 15:52 +0200
Message-ID<XnsA5F7A189A388Deejj99@194.109.6.166>
In reply to#30362
"Michael Haufe (TNO)" <tno@thenewobjective.com> wrote on 27 Apr 2016 in
comp.lang.javascript: 
> On Wednesday, April 27, 2016 at 7:07:34 AM UTC-5, Cezary Tomczyk wrote:
>> I don't think so it's obsolete.
> 
> Don't reference a Draft if you are making an argument about what is
> standard. 

Not obsolete does not equal being standard.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#30367

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2016-04-27 10:57 -0700
Message-ID<96705275-eab5-4146-8ddf-3dbb760ead31@googlegroups.com>
In reply to#30363
On Wednesday, April 27, 2016 at 8:53:33 AM UTC-5, Evertjan. wrote:
> "Michael Haufe (TNO)" wrote on 27 Apr 2016 in
> comp.lang.javascript: 
> > On Wednesday, April 27, 2016 at 7:07:34 AM UTC-5, Cezary Tomczyk wrote:
> >> I don't think so it's obsolete.
> > 
> > Don't reference a Draft if you are making an argument about what is
> > standard. 
> 
> Not obsolete does not equal being standard.

ACK

I think I've lost track of the argument due to my glancing over the thread. Let me realign:

Is the method standard? 
    defacto: yes. [1]
    dejure: no. [2]

Therefore wariness would be prudent

[1] <http://caniuse.com/#search=Element.insertAdjacentHTML%28%29>
[2] Other arguments in this thread. (Becker and Tomczyk)

[toc] | [prev] | [next] | [standalone]


#30364

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2016-04-27 16:00 +0200
Message-ID<nfqgl9$f70$1@solani.org>
In reply to#30362
Michael Haufe (TNO) wrote:

> Don't reference a Draft if you are making an argument about what is standard.
> 
> <https://www.w3.org/TR/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text>

From the linked document (emphasis mine):

| This is a *draft* document and may be updated, replaced or obsoleted |
by other documents at any time. It is inappropriate to cite this
| document as other than work in progress.

:)

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#30366

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2016-04-27 10:48 -0700
Message-ID<51d3ded4-8bf6-42b2-b373-1865a2c3c371@googlegroups.com>
In reply to#30364
On Wednesday, April 27, 2016 at 9:00:14 AM UTC-5, Christoph M. Becker wrote:
> Michael Haufe (TNO) wrote:
> 
> > Don't reference a Draft if you are making an argument about what is standard.
> > 
> > <https://www.w3.org/TR/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text>
> 
> From the linked document (emphasis mine):
> 
> | This is a *draft* document and may be updated, replaced or obsoleted |
> by other documents at any time. It is inappropriate to cite this
> | document as other than work in progress.
> 
> :)

ACK.

<https://www.w3.org/TR/#tr_DOM>

[toc] | [prev] | [next] | [standalone]


#30370

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2016-04-27 20:19 +0100
Message-ID<b3cc7$572110b7$520da86c$4308@nntpswitch.blueworldhosting.com>
In reply to#30364
On 27/04/2016 15:00, Christoph M. Becker wrote:
> Michael Haufe (TNO) wrote:
>
>> Don't reference a Draft if you are making an argument about what is standard.
>>
>> <https://www.w3.org/TR/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text>
>
>  From the linked document (emphasis mine):
>
> | This is a *draft* document and may be updated, replaced or obsoleted |
> by other documents at any time. It is inappropriate to cite this
> | document as other than work in progress.
>
> :)

Right. Thank you for pointing this out. :-)

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30373

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-04-27 21:42 +0200
Message-ID<487266585.jNvvlsRGfx@PointedEars.de>
In reply to#30370
Cezary Tomczyk wrote:

> On 27/04/2016 15:00, Christoph M. Becker wrote:
>> Michael Haufe (TNO) wrote:
>>> Don't reference a Draft if you are making an argument about what is
>>> standard.
>>>
>>> <https://www.w3.org/TR/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text>
>>
>>  From the linked document (emphasis mine):
>>
>> | This is a *draft* document and may be updated, replaced or obsoleted |
>> by other documents at any time. It is inappropriate to cite this
>> | document as other than work in progress.
>>
>> :)
> 
> Right. Thank you for pointing this out. :-)

It is rather unlikely now, but it still might become a W3C Recommendation.
The inappropriately cited Editor’s Draft was from 2014-06-05.  This is the 
most recent version of it:

<https://www.w3.org/TR/2014/CR-DOM-Parsing-20140617/>

It is not surprising that the editor of this specification draft was 
employed by Microsoft.  It is also not surprising that after almost two 
years there is not even a Proposed Recommendation:

“This specification will not advance to Proposed Recommendation before the 
spec's test suite is completed and two or more independent implementations 
pass each test, although no single implementation must pass each test. We 
expect to meet this criteria no sooner than 17 October 2014. The group will 
also create an Implementation Report.”

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#30372

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-04-27 21:33 +0200
Message-ID<2981827.leRlmMJCvi@PointedEars.de>
In reply to#30361
Cezary Tomczyk wrote:

> On 26/04/2016 16:49, Thomas 'PointedEars' Lahn wrote:
>> JJ wrote:
>>> On Tue, 26 Apr 2016 09:01:13 +0200, Jake Jarvis wrote:
>>>> Am 26.04.2016 um 08:09 schrieb bit-naughty@hotmail.com:
>>>>> I know about AppendChild, but if I say, have a <div> and I want
>>>>> another <div> *next* to it to appear when a particular button is
>>>>> clicked - i.e. _it's at the same level in the DOM tree_ !!! , then
>>>>> what do I do? Thanks.
>>>> Go up one level to the parent element and use the
>>>> insertBefore(newChild, refChild) method.
>>> Or insertAdjacentHTML(). Whichever is applicable.
>> insertAdjacentHTML() is proprietary, inefficient, and error-prone; and it
>> is obsolete since IE/MSHTML 5.
> 
> Based on:
> 
> *
> https://w3c.github.io/DOM-Parsing/#widl-Element-insertAdjacentHTML-void-DOMString-position-DOMString-text

Proprietary, only specified there because the vendors of the browsers whose 
representatives command the WHATWG, for some weird reason thought it would 
be a pretty neat idea to start supporting obsolete IE/MSHTML features.  
Surprisingly, and unfortunately, that included Mozilla which, at some point 
in time after they went commercial, started to support “document.all” when 
“document.all” was already obsolete in MSHTML thanks to introducing W3C DOM 
support.

> * https://msdn.microsoft.com/en-us/library/ms536452%28v=vs.85%29.aspx

AISB.  “There are no standards that apply here.”

> https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML

AISB.
 
> I don't think so it's obsolete.

You are mistaken.
 
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#30374

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2016-04-27 21:44 +0200
Message-ID<1602248.pLac4ON8i8@PointedEars.de>
In reply to#30372
Thomas 'PointedEars' Lahn wrote:

> Cezary Tomczyk wrote:
>> <https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML>
> 
> AISB.

Also note that <https://developer.mozilla.org/en-US/docs/Web/API/Element> 
lists it as *experimental*.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#30376

FromCezary Tomczyk <cezary.tomczyk@gmail.com>
Date2016-04-27 22:30 +0100
Message-ID<928c0$57212f84$1196dbc8$5660@nntpswitch.blueworldhosting.com>
In reply to#30374
On 27/04/2016 20:44, Thomas 'PointedEars' Lahn wrote:
> Thomas 'PointedEars' Lahn wrote:
>
>> Cezary Tomczyk wrote:
>>> <https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML>
>>
>> AISB.
>
> Also note that <https://developer.mozilla.org/en-US/docs/Web/API/Element>
> lists it as *experimental*.

Fair enough. So much inconsistency in specs.

-- 
Cezary Tomczyk
http://www.ctomczyk.pl/

[toc] | [prev] | [next] | [standalone]


#30382

Frombit-naughty@hotmail.com
Date2016-04-30 05:48 -0700
Message-ID<c0d071a3-5981-4fe5-b71a-c4a53f680ea5@googlegroups.com>
In reply to#30328
On Tuesday, April 26, 2016 at 12:31:20 PM UTC+5:30, Jake Jarvis wrote:

> 
> Go up one level to the parent element and use the insertBefore(newChild, 
> refChild) method.


If I do that, will it APPEAR straightaway? I want it to remain invisible till I fiddle with it's CSS properties......

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web