Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.java.* > Newsgroup comp.lang.javascript

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-25-2009, 03:37 PM
Andy Fish
Guest
 
Posts: n/a
Default Re: standards-compliant equivalent of innerHTML


> That is not what I read. I read a procession of reports from
> individuals who have no idea of how to analyse a problem and a certain
> amount of speculation.


ok, I'll go back and have a closer look. from what I could see, the
examples (or at least some of them) in those posts should definitely
have worked

> Again, that should be questioned. *If it is not a full document how
> can it be validated, and if it is a full document inserting it into
> another certainly will result in invalid mark-up. You know something
> about these fragments, but so far you have not said exactly what it is
> that you know about them.
>


ok although i accept the argument that a fragment of HTML cannot be
said to be valid HTML in isolation, i thought I made it clear when I
said that the resultant document was valid HTML. in other words, if
you simply did a text substitution to replace the fragment, the result
would be a valid HTML document
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 11-26-2009, 01:25 AM
RobG
Guest
 
Posts: n/a
Default Re: standards-compliant equivalent of innerHTML

On Nov 26, 2:37 am, Andy Fish <ajf...@blueyonder.co.uk> wrote:
> > That is not what I read. I read a procession of reports from
> > individuals who have no idea of how to analyse a problem and a certain
> > amount of speculation.

>
> ok, I'll go back and have a closer look. from what I could see, the
> examples (or at least some of them) in those posts should definitely
> have worked


What is required is a definite statement of the issue and a minimal
example that demonstrates it.

From reading posts on the web and my limited testing, IE seems to have
an issue if updating the innerHTML property of an element results in
invalid markup. Here is a simple test case:

<div>
<p id="p0"></p>
<input type="button" value="Update inneHTML" onclick="
var p0 = document.getElementById('p0');
p0.innerHTML = '<li>I am an li</li>';
">
</div>

If the above is placed in a valid HTML document, clicking the button
will result in the innerHTML of the p element being set to invalid
markup. Firefox inserts an li element and displays the text, IE throws
an "Unknown runtime error".


> > Again, that should be questioned. If it is not a full document how
> > can it be validated, and if it is a full document inserting it into
> > another certainly will result in invalid mark-up. You know something
> > about these fragments, but so far you have not said exactly what it is
> > that you know about them.

>
> ok although i accept the argument that a fragment of HTML cannot be
> said to be valid HTML in isolation, i thought I made it clear when I
> said that the resultant document was valid HTML. in other words, if
> you simply did a text substitution to replace the fragment, the result
> would be a valid HTML document


If you can demonstrate that, then post sample code or link.

You seem to want to be able to insert any HTML fragment into your
document and have the browser deal with it. That seems like an
unreasonable expectation.

If you want to insert HTML fragments into documents then you must
either:

1. Impose a restriction that fragments must result in a valid document
when inserted into, say, a div element (e.g. a fragment can't start
with an li tag)

or

2. You must inspect the first tag of the fragment and, depending on
the element that will become its parent, wrap the fragment in a
suitable element so that when it is inserted in the document the
result is valid markup

As for XML or XHTML, if you aren't going to use HTML you might as well
use JSON.


--
Rob
Reply With Quote
  #3 (permalink)  
Old 11-26-2009, 10:01 AM
Andy Fish
Guest
 
Posts: n/a
Default Re: standards-compliant equivalent of innerHTML

ok thanks to everyone for all your help on this. It's clear there is
no magic bullet.

However, I was obviously a bit quick to assume that examples I found
on other forums were due to a bug or bugs in IE whereas it appears
they may have been down to malformed HTML documents, so I'll go back
and check this.

If innerHTML is reliable on all the browsers I want to support when
the HTML is valid, I am happy to continue using it.
Reply With Quote
 
Reply

Popular Tags in the Forum
equivalent, innerhtml, standardscompliant

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: standards-compliant equivalent of innerHTML Thomas 'PointedEars' Lahn Newsgroup comp.lang.javascript 0 11-25-2009 02:38 PM
Re: standards-compliant equivalent of innerHTML optimistx Newsgroup comp.lang.javascript 1 11-25-2009 12:57 PM
Re: standards-compliant equivalent of innerHTML Stevo Newsgroup comp.lang.javascript 2 11-25-2009 12:49 PM
how can solve this senario? Shaik Hymad Newsgroup comp.soft-sys.sas 1 10-28-2009 02:18 PM
W3C Standards Compliant jzakiya Newsgroup comp.lang.ruby 0 07-07-2009 06:23 PM



All times are GMT. The time now is 04:27 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.