"Jeff Thies" <nospam@nospam. net> writes:
[color=blue]
> To my surprise, insertAdjacentH TML is not supported in Netscape.[/color]
Yes, it's a proprietary IE method, as are innerText and innerHTML,
although the latter turned out to be so popular that it is implemented
in most new browsers anyway.
[color=blue]
> Can this be prototyped, or are there similar DOM 2 methods?[/color]
It probably could, but only in Mozilla based browsers. Other browsers,
like Opera and Safari wouldn't be helped by that, whereas using DOM 2
methods would most likely work in all modern browsers and in IE.
There are no DOM 2 methods that parse HTML. To use DOM 2 methods to
create content, you either build it using document.create Element and
document.create TextNode, or you include it in the page, invisible, and
copies it around.
If it's just a simple text, it's easy.
var node = document.create TextNode("simpl e text");
To insert it adjacent to an element, elem, you can do the following:
before:
elem.parentNode .insertBefore(n ode, elem);
at beginning:
elem.insertBefo re(node, elem.firstChild );
at end:
elem.appendChil d(node) or elem.insertBefo re(node, null);
after:
elem.parentNode .insertBefore(n ode, elem.nextSiblin g);
The same works for more complicated nodes than just a plain text, e.g.,
var node = document.create DocumentFragmen t();
node.appendChil d(document.crea teTextNode("it "));
var em = document.create Element("em");
em.appendChild( document.create TextNode("is")) ;
node.appendChil d(em);
node.appendChil d(document.crea teTextNode(" easy!"));
then insert node adjacent to an element as above.
It's a litte verbose, but it's quite easy to get the hang of.
/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jeff Thies wrote:
[color=blue]
> To my surprise, insertAdjacentH TML is not supported in Netscape.[/color]
It somehow surprises me that that surprises you now after all the years
Netscape 6/7 have been with us.
[color=blue]
> Can this be prototyped, or are there similar DOM 2 methods?[/color]
Yes, it can be prototyped using createContextua lFragment, see
however as createContextua lFragment is a Mozilla extension you might be
better off to use DOM Level 2 only as already suggested.
However Opera 7 also supports insertAdjacentH TML. Any Safari or
Konqueror users reading here that could let us know whether those
browsers support insertAdjacentH TML?
--
"Martin Honnen" <mahotrash@yaho o.de> wrote in message
news:40dd811d$1 @olaf.komtel.ne t...[color=blue]
>
>
> Jeff Thies wrote:
>[color=green]
> > To my surprise, insertAdjacentH TML is not supported in Netscape.[/color]
>
> It somehow surprises me that that surprises you now after all the years
> Netscape 6/7 have been with us.[/color]
Well, I deserve that! My javascript mind has been on hiatus.
NS6 always ran like a dog for me, fortunately it never captured much market
share as most NS users stuck with NS4.
NS7, Opera 7 and Safari has got me thinking again... about how much I
forgot.
<snip>
[color=blue]
> Yes, it's a proprietary IE method, as are innerText and innerHTML,
> although the latter turned out to be so popular that it is implemented
> in most new browsers anyway.[/color]
Do you know of any recent browsers that fail to implement innerHTML?
"Jeff Thies" <nospam@nospam. net> writes:
[color=blue]
> Do you know of any recent browsers that fail to implement innerHTML?[/color]
No, but I don't know all recent browsers.
I believe Safari supports it, but can't check it.
I'm not so sure about ICEBrowser.
What recent browsers are there?
/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
"Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
news:d63mme5u.f sf@hotpop.com.. .[color=blue]
> "Jeff Thies" <nospam@nospam. net> writes:
>[color=green]
> > Do you know of any recent browsers that fail to implement innerHTML?[/color]
>
> No, but I don't know all recent browsers.
>
> I believe Safari supports it, but can't check it.[/color]
Yes, it does.
[color=blue]
> I'm not so sure about ICEBrowser.
>
> What recent browsers are there?[/color]
"Jeff Thies" <nospam@nospam. net> writes:
[color=blue]
> "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message[/color]
[color=blue][color=green]
>> What recent browsers are there?[/color][/color]
....[color=blue]
> <URL: http://www.download.com/sort/3150-2356-0-1-2.html? >
>
> There's only about 20 in the last month. I have no idea how many are IE
> based.[/color]
That is, of 23 browsers, *one* is not based on either IE, Mozilla or
Opera technology: Image Browser, and it doesn't support scripting at
all.
Three fail to say anything about their technology (but I'll be very
surpriced if they aren't using the IE browsers component)
/L
[1] Would you trust a browser manufacturer that sends their home page as
"text/plain"? <URL:http://www.smartalec20 00.com/>
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen wrote:
[color=blue]
> [1] Would you trust a browser manufacturer that sends their home page as
> "text/plain"? <URL:http://www.smartalec20 00.com/>[/color]
Whats worse is a browser based on technology that displays that
text/plain as a webpage :-x
Comment