FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > General Coding/Development
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 07-08-2005, 08:31 PM   Postid: 135654
Don
Registered User

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Jun 2005
Posts: 71
Re: innerHTML rant

Quote:
Originally Posted by Joseph
Most of our smilies have been reshaped to fit that outline shape...
Well, not yours. Perhaps you have not been assimilated yet.
Don is offline   Reply With Quote
Old 07-08-2005, 08:38 PM   Postid: 135655
Joseph
Site Owner
 
Joseph's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Dec 2004
Location: Colorado, USA
Posts: 469
Re: innerHTML rant

.
__________________
FutureQuest, Inc.
http://www.FutureQuest.net
Joseph is offline   Reply With Quote
Old 07-08-2005, 11:00 PM   Postid: 135657
trojjer
Registered User

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Jul 2005
Posts: 6
Re: innerHTML rant

By the way, can anyone explain properly why element.innerHTML is such a "bad" property? I know it's proprietary in origin; but isn't it supported in more browsers these days, than the official Standards Compliant way? It's just a guess, that one, can anyone follow it up...?

I like most of the W3C DOM specifications, btw, and I'm trying to use them where I can -- but I don't like the idea of having to laboriously "Walk the DOM" whenever I just want to add a prefabricated HTML string. Even Firefox supports this, in Compliant mode no less; whereas in comparison, they infamously won't "give in" and implement the overly-abused (but equally missed?) tooltip text display that appears when you mouseover an image with alt-text.*

Besides, why can't the browser just insert the HTML into the document as if it was there in the first place? By that, I mean, if it's already structured HTML, shouldn't the parent/child structure of the "fragment" be known anyway, prior to insertion into the main DOM tree? The same applies to my expectations of the property, when it's used to retrieve content. Well, I'm going to see now, just in case.

I wonder if anyone's tested this before? Help me try it in different browsers, please; if it works as I think it should (crossed-fingers), the children of the first "DOM-made" DIV should be copied into a second container (which has a different ID of course, and is also derived from document.createElement -- it's a clone of the first DIV and its children). W3C DOM methods have their uses and I respect them -- but this will help prove how much we can "opt out" and rely on innerHTML if we want, to cut down on the nested looping or whatever may be necessary at the time, to determine what childNode we want, and all that...

Also, I want to know how far its abilities extend when using a mixed approach, as you can see:

HTML Code:
<html><head><title>.innerHTML Property Test</title>
<script language="javascript"><!--
function makeAndCopy() {
var div1=document.createElement('div'); div1.id='div1';
var div2=div1.cloneNode(false); div2.id='div2';              

div1.innerHTML='<p>div1</p><div class="child"><p>child</p><span class="descendant">descendant</span></div>';

// Into the DOM tree it goes:
document.body.appendChild(div1);

// You can read the className[s] of the children, as an example:
var childNode=div1.childNodes[1];
alert('The className of the DIV element childNode is: '+childNode.className);

// clone, edit, then add a new labelling paragraph:
var para=div1.firstChild.cloneNode(true);
para.firstChild.nodeValue='div2'; // not forgetting it's a textNode child
div2.appendChild(para);

// now to clone the child (and the descendant <span> -- parameter set to _true_) and put them into div2:
div2.appendChild(childNode.cloneNode(true));

document.body.appendChild(div2); }
//--></script>

<style type="text/css"><!--
div {text-align:center; width:200px; margin:20px; padding:14px; background-color:#369;}
div#div1 {border:2px blue solid;}
div#div2 {border:2px red solid;}
div p {color:white;}
.child {border:1px white solid; background-color:black; width:65%;}
.descendant {background-color:white;}
--></style></head>

<body onload="makeAndCopy();">
<p>[Dynamic Content Below]</p>
</body></html>
Well, it works fine in Firefox and IE6 (*trumpet flaring*, lol) -- anyone else?

* I don't know where I stand on that off-topic issue, really. Fair enough, more people should use the title attribute as a longer description, and keep alt-text as simple alternative textual representation, where needed... But the distinction often seems blurred to me, about where the "split" should be. lol, the debate is very heated and long-in-the-tooth by now, on the Mozilla bugtracker forums...

PS: Oh, right, so they've mostly been assimilated have they? Oh no... lol... "Resistance is Futile"
trojjer is offline   Reply With Quote
Old 07-09-2005, 12:27 AM   Postid: 135659
Andilinks
Site Owner
 
Andilinks's Avatar

Forum Notability:
338 pts: An Honor To Be Around
[Post Feedback]
 
Join Date: Apr 2002
Location: San Antonio, Texas
Posts: 7,204
Re: innerHTML rant

Meditating upon the FutureQuest logo (once you get past that fish skeleton thing) will put you in touch with your inner HTML...
__________________
@andilinks Twitter � Andrea Silver FB
Andilinks is offline   Reply With Quote
Old 07-09-2005, 04:14 AM   Postid: 135661
phppete
Registered User
 
phppete's Avatar

Forum Notability:
238 pts: Ambassador of Goodwill
[Post Feedback]
 
Join Date: May 2003
Posts: 1,490
Re: innerHTML rant

For innerHTML info look here http://www.quirksmode.org/dom/innerhtml.html, its actually faster than the W3C method.
phppete is offline   Reply With Quote
Old 07-09-2005, 07:59 AM   Postid: 135669
kitchin
Site Owner

Forum Notability:
1163 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Jan 2001
Location: Virginia
Posts: 3,008
Re: innerHTML rant

Mr.QuirksMode (Peter-Paul Koch) also has a page with good DHTML writing function, which accounts for various browser quirks and explains them:
http://www.quirksmode.org/js/layerwrite.html
(Google "site:quirksmode.org searchterm" is how I search that xclnt site.)
kitchin is offline   Reply With Quote
Old 07-09-2005, 01:24 PM   Postid: 135677
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,642
Re: innerHTML rant

Quote:
once you get past that fish skeleton thing
So I'm not the only one who sees that? Whew... I was afraid it was some sort of latent ichthyophobia on my part

Randall
__________________
Where's Randall?
Randall is offline   Reply With Quote
Old 07-09-2005, 03:20 PM   Postid: 135680
trojjer
Registered User

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Jul 2005
Posts: 6
Re: innerHTML rant

Ah yes, I'm also a regular browser of Quirksmode.org; I assumed PPK might've already done a writeup of it too... Thanks.

"Fish skeleton"?? Hmm...
trojjer is offline   Reply With Quote
Old 07-10-2005, 02:52 AM   Postid: 135690
sheila
Site Owner
 
sheila's Avatar

Forum Notability:
0 pts: Even-handed
[Post Feedback]
 
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
Re: innerHTML rant

Quote:
Originally Posted by Randall
So I'm not the only one who sees that? Whew...
Certainly not.

Crunchy Chris referred at least once to my associates as "The Dead Fish People". I always smack him when he says that. Well, or at least shoot him a deadly look.
__________________
sheila
http://www.thinkspot.net/sheilaruns/

Last edited by sheila : 07-11-2005 at 09:29 PM. Reason: accuracy and fairness. :P
sheila is offline   Reply With Quote
Old 07-10-2005, 05:35 AM   Postid: 135692
 Terra
CTO FutureQuest, Inc.
 
Terra's Avatar
 
Join Date: Jun 1998
Location: Z'ha'dum
Posts: 7,719
Re: innerHTML rant

Quote:
once you get past that fish skeleton thing

LOL - well, ummmm, that certainly wasn't the intent...

It may also help by viewing the final logo design in black and white (Visio ==> GIF) before we colorized it for integration into our site design...
http://www.FutureQuest.net/images/FQuest_Logo_Final.gif

Here is a blast from the past that describes the motivation that went into our logo design:
http://www.aota.net/forums/showthrea...id=273#post273

--
Terra
--there were no fish harmed during the making of our logo--
FutureQuest
Terra is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 03:18 AM.


Running on vBulletin®
Copyright © 2000 - 2014, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2014 FutureQuest, Inc.
FutureQuest, Inc.