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


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

innerHTML

Started byGene Wirchenko <genew@ocis.net>
First post2011-12-22 18:55 -0800
Last post2012-01-04 08:54 +0100
Articles 10 — 9 participants

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


Contents

  innerHTML Gene Wirchenko <genew@ocis.net> - 2011-12-22 18:55 -0800
    Re: innerHTML Andrew Poulos <ap_prog@hotmail.com> - 2011-12-23 15:18 +1100
    Re: innerHTML Christian Kirsch <ck@bru6.de> - 2011-12-23 11:09 +0100
      Re: innerHTML Gregor Kofler <usenet@gregorkofler.com> - 2011-12-23 13:52 +0100
        Re: innerHTML Bwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid> - 2012-01-06 14:35 +0530
          Re: innerHTML Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2012-01-11 08:36 +0100
            Re: innerHTML "J.R." <groups_jr-1@yahoo.com.br> - 2012-01-11 07:16 -0200
              Re: innerHTML Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2012-01-14 22:16 +0100
    Re: innerHTML Dr J R Stockton <reply1151@merlyn.demon.co.uk> - 2011-12-24 20:57 +0000
    Re: innerHTML Arno Welzel <usenet@arnowelzel.de> - 2012-01-04 08:54 +0100

#9551 — innerHTML

FromGene Wirchenko <genew@ocis.net>
Date2011-12-22 18:55 -0800
SubjectinnerHTML
Message-ID<36r7f719terpj6d2guc8v2hicvnmsgilvc@4ax.com>
Dear JavaScripters:

     The FAQ states:
9.4 How do I modify the content of the current page?
Using the non-standard but widely implemented innerHTML property...

     Is it still the case that it is non-standard?  Is there an
alternative that is standard?

Sincerely,

Gene Wirchenko

[toc] | [next] | [standalone]


#9552

FromAndrew Poulos <ap_prog@hotmail.com>
Date2011-12-23 15:18 +1100
Message-ID<xIKdnZlMAJyYnGnTnZ2dnUVZ_rSdnZ2d@westnet.com.au>
In reply to#9551
On 23/12/2011 1:55 PM, Gene Wirchenko wrote:
> Dear JavaScripters:
>
>       The FAQ states:
> 9.4 How do I modify the content of the current page?
> Using the non-standard but widely implemented innerHTML property...
>
>       Is it still the case that it is non-standard?  Is there an
> alternative that is standard?

I believe that DM posted a tip recently that covered innerHTML.

Andrew Poulos

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


#9554

FromChristian Kirsch <ck@bru6.de>
Date2011-12-23 11:09 +0100
Message-ID<4ef45360$0$7623$9b4e6d93@newsspool1.arcor-online.net>
In reply to#9551
Gene Wirchenko schrieb:
> Dear JavaScripters:
> 
>      The FAQ states:
> 9.4 How do I modify the content of the current page?
> Using the non-standard but widely implemented innerHTML property...
> 
>      Is it still the case that it is non-standard?  Is there an
> alternative that is standard?
> 

The usual DOM methods are standard (createElement, addChildElement etc.)

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


#9557

FromGregor Kofler <usenet@gregorkofler.com>
Date2011-12-23 13:52 +0100
Message-ID<jd1til$qn3$1@dont-email.me>
In reply to#9554
Am 2011-12-23 11:09, Christian Kirsch meinte:
> Gene Wirchenko schrieb:
>> Dear JavaScripters:
>>
>>      The FAQ states:
>> 9.4 How do I modify the content of the current page?
>> Using the non-standard but widely implemented innerHTML property...
>>
>>      Is it still the case that it is non-standard?  Is there an
>> alternative that is standard?

innerHTML is widely supported, but no standard yet. Particularly with
(older) IE browsers innerHTML has its fair share of issues.

> 
> The usual DOM methods are standard (createElement, addChildElement etc.)
                                                     ^^^^^^^^^^^^^^^

Erm... I suppose you meant node.appendChild() and its sibling methods.

Gregor

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


#9954

FromBwig Zomberi <zomberiMAPSONNOSPAM@gmail.invalid>
Date2012-01-06 14:35 +0530
Message-ID<je6d3s$v7v$2@speranza.aioe.org>
In reply to#9557
Gregor Kofler wrote:
> innerHTML is widely supported, but no standard yet. Particularly with
> (older) IE browsers innerHTML has its fair share of issues.

textContent

-- 
Bwig Zomberi

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


#10131

FromHans-Georg Michna <hans-georgNoEmailPlease@michna.com>
Date2012-01-11 08:36 +0100
Message-ID<2reqg7ppct0ar29bas0503ucd0mcr79q07@4ax.com>
In reply to#9954
On Fri, 06 Jan 2012 14:35:51 +0530, Bwig Zomberi wrote:

>Gregor Kofler wrote:

>> innerHTML is widely supported, but no standard yet. Particularly with
>> (older) IE browsers innerHTML has its fair share of issues.

>textContent

That is not supported by Internet Explorer, at least not up to
version 8, maybe not even 9.

So if you want to support these browsers, like every
conscientious web programmer would do, you cannot use
textContent or you have to fall back on a contraption around
innerHTML for IE. The contraption depends on circumstances. See
http://winhlp.com/node/610#toade for some hints.

Hans-Georg

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


#10133

From"J.R." <groups_jr-1@yahoo.com.br>
Date2012-01-11 07:16 -0200
Message-ID<jejk1i$glo$1@speranza.aioe.org>
In reply to#10131
On 11/01/2012 05:36, Hans-Georg Michna wrote:
> On Fri, 06 Jan 2012 14:35:51 +0530, Bwig Zomberi wrote:
>
>> Gregor Kofler wrote:
>
>>> innerHTML is widely supported, but no standard yet. Particularly with
>>> (older) IE browsers innerHTML has its fair share of issues.
>
>> textContent
>
> That is not supported by Internet Explorer, at least not up to
> version 8, maybe not even 9.
>

textContent property (DOM Level 3) is now supported by IE9. See 
<http://msdn.microsoft.com/en-us/library/ff974773(v=vs.85).aspx>

IE prior to version 9 supports innerText.

> So if you want to support these browsers, like every
> conscientious web programmer would do, you cannot use
> textContent or you have to fall back on a contraption around
> innerHTML for IE. The contraption depends on circumstances. See
> http://winhlp.com/node/610#toade for some hints.

Difference between innerText and textContent:
see <https://developer.mozilla.org/En/DOM/Node.textContent>
  *  innerText -> implemented in IE prior to version 9.
  *  textContent -> DOM Level 3 - IE9, FF, Safari, etc.
  *  Google Chrome seems to implement both innerText and textContent.

-- 
Joao Rodrigues (J.R.)

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


#10238

FromHans-Georg Michna <hans-georgNoEmailPlease@michna.com>
Date2012-01-14 22:16 +0100
Message-ID<srr3h7lu28a5iec0rrras79db8tkb0uep0@4ax.com>
In reply to#10133
On Wed, 11 Jan 2012 07:16:37 -0200, J.R. wrote:

>textContent property (DOM Level 3) is now supported by IE9. See 
><http://msdn.microsoft.com/en-us/library/ff974773(v=vs.85).aspx>
>
>IE prior to version 9 supports innerText.

>Difference between innerText and textContent:
>see <https://developer.mozilla.org/En/DOM/Node.textContent>
>  *  innerText -> implemented in IE prior to version 9.
>  *  textContent -> DOM Level 3 - IE9, FF, Safari, etc.
>  *  Google Chrome seems to implement both innerText and textContent.

Thanks a lot! Changed http://winhlp.com/node/610#toade
accordingly.

Hans-Georg

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


#9586

FromDr J R Stockton <reply1151@merlyn.demon.co.uk>
Date2011-12-24 20:57 +0000
Message-ID<ujYUxcLsyj9OFwdU@invalid.uk.co.demon.merlyn.invalid>
In reply to#9551
In comp.lang.javascript message <36r7f719terpj6d2guc8v2hicvnmsgilvc@4ax.
com>, Thu, 22 Dec 2011 18:55:21, Gene Wirchenko <genew@ocis.net> posted:

>     The FAQ states:
>9.4 How do I modify the content of the current page?
>Using the non-standard but widely implemented innerHTML property...
>
>     Is it still the case that it is non-standard?  Is there an
>alternative that is standard?


If you only want to change plain ordinary text to plain ordinary text,
you can expect no problem, at least in current GUI browsers.

In my <http://www.merlyn.demon.co.uk/holidays.htm> - is it right for
Canada? - the tables (when on the same page) are written with innerHTML,
disguised in function Wryt.


IIRC, problems come if one tries to rebuild the structure of a Table.


The theoretically-favoured way is to use the properties of elements to
alter the DOM tree.  For an example, see
<http://www.merlyn.demon.co.uk/inc-prop.js>, which provides two
functions, one of which creates a moderately complex first Form, which
may be seen first in <http://www.merlyn.demon.co.uk/js-props.htm>.

You may now wonder what those properties are -- press the Enter button
on the Form, double-click 'body', Enter, double-click 'children', etc.
        BUT, after double-clicking a number, just under the
        Enter, replace, for example, x.y.z.7 with x.y.z[7] until I do
        something about it.  TOO LATE, I just did.

-- 
 (c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk  Turnpike 6.05  WinXP.
 Web  <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links.
 Command-prompt MiniTrue is useful for viewing/searching/altering files. Free,
 DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.

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


#9906

FromArno Welzel <usenet@arnowelzel.de>
Date2012-01-04 08:54 +0100
Message-ID<4F0405B5.1010706@arnowelzel.de>
In reply to#9551
Gene Wirchenko, 2011-12-23 03:55:

> Dear JavaScripters:
> 
>      The FAQ states:
> 9.4 How do I modify the content of the current page?
> Using the non-standard but widely implemented innerHTML property...
> 
>      Is it still the case that it is non-standard?  Is there an
> alternative that is standard?

With HTML5 innerHTML will become a standard.

See also:

<http://www.w3.org/TR/2008/WD-html5-20080610/dom.html#innerhtml0>
<http://www.w3.org/TR/2008/WD-html5-20080610/dom.html#innerhtml1>

Anyway - the problem remains, that you may end up with an invalid
document when you insert invalid markup using innerHTML and the browser
has to parse the given markup with every change of the innerHTML property.

For more complex stuff you should use the DOM methods. This will be
faster and you can not create invalid documents accidentally.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [standalone]


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


csiph-web