[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    DOM:createElement - doesn't like nested elements?
From:       Vadim Plessky <lucy-ples () mtu-net ! ru>
Date:       2001-09-18 20:14:49
[Download RAW message or body]

I renewed several stress tests which I had on my disk.
Pls see 3 HTML files attached. All of them run ok in Mozilla 0.9.1.

Example using IMG inside P element is not W3C compliant (there was recent 
dicussion on similar topic IIRC on koffice-devel).
But Mozilla displays what is expected (600 images with links)
Konq shows empty space.

Secons example (-DIV) re-worked to satisfy *demanding* W3C conformists :-)
It *should* work IMO, but for some reason it's empty in Konq as well.

Third one works with Konq. In it, I insert blank paragraph (P) between 
images, and append everything to document.body (no *NESTING*)
The only way I can explain this is that Konq initialized created elements in 
some strange way. And obviously it doesn't like nesting.
(I have another test which shows similar effect, with 3-4 levels of nesting)
As I see in konsole output, in every example Konq makes assignments to CSS 
properties, as many times as cycle has. And assignments in all 3 testcases 
are quite similar. 
khtml (css): applying property 42
khtml (css): applying property 88

But elements in cases 1 and 2 are not displayed...

Peter Kelly cured several DOM-related bugs just few days before KDE 2.1 
release. :-)
Can you (someone else?) take a look on attached code - will it tell you 
something?..
These examples are not of *academic interest* anymore.
I have seen on www-dom list one guy trying to parse into DOM 2MB XML file, 
created from database. And we can expect that more people will merge data 
handling with XML, generating sources close to these examples.
So, fixing such examples will help a lot, IMHO.
-- 

Vadim Plessky
http://kde2.newmail.ru  (English)
33 Window Decorations and 6 Widget Styles for KDE
http://kde2.newmail.ru/kde_themes.html
Do you have Arial font installed? Just test it!
http://kde2.newmail.ru/font_test_arial.html

["LongHTML_createElement3-P.html" (text/html)]

<HTML>
<HEAD><TITLE>Test for Long HTML files - using createElement DOM method</TITLE>
</HEAD>

<BODY>
<H2>This image, Ice Forest, will be displayed below 600 times.</H2>
<IMG SRC="ice_forest.gif" WIDTH="150" HEIGHT="100" BORDER="0" ALT="Forest Picture">
<P>START...</P>

<SCRIPT language=JavaScript>
  var myhead, myline, myhref, i;

 myhead = document.createElement("H2");
 document.body.appendChild( myhead );

for (i=0; i < 600 ; i++)
{
  myline = document.createElement("P");

  myimg = document.createElement("IMG");
  myimg.src= "ice_forest.gif";
  myimg.width= 150;
  myimg.height = 100;
  myline.appendChild( myimg );

  myhref = document.createElement("A");
  myhref.href= "font.zip";
  myhref.innerHTML = "Image no " + i;
  myline.appendChild( myhref );

  //  now, attach new line to H2 header (myhead)
//  myhead.appendChild( myline );

// changed to document.body
  document.body.appendChild( myline );

}

</SCRIPT>
<P>FINISH...<BR>
You should see 600 images above</P>

</BODY>

</HTML>
["LongHTML_createElement4-DIV.html" (text/html)]

<HTML>
<HEAD><TITLE>Test for Long HTML files - using createElement DOM method</TITLE>
</HEAD>

<BODY>
<H2>This image, Ice Forest, will be displayed below 600 times.</H2>
<IMG SRC="ice_forest.gif" WIDTH="150" HEIGHT="100" BORDER="0" ALT="Forest Picture">
<P>START...</P>

<SCRIPT language=JavaScript>
  var myhead, myline, myhref, i;

 myhead = document.createElement("H2");
 document.body.appendChild( myhead );

for (i=0; i < 600 ; i++)
{
  myline = document.createElement("DIV");

  myimg = document.createElement("IMG");
  myimg.src= "ice_forest.gif";
  myimg.width= 150;
  myimg.height = 100;
  myline.appendChild( myimg );

  myhref = document.createElement("A");
  myhref.href= "font.zip";
  myhref.innerHTML = "Image no " + i;
  myline.appendChild( myhref );

  //  now, attach new line to H2 header (myhead)
//  myhead.appendChild( myline );

// changed to document.body
  document.body.appendChild( myline );

}

</SCRIPT>
<P>FINISH...<BR>
You should see 600 images above</P>

</BODY>

</HTML>

["LongHTML_createElement5-noDIV.html" (text/html)]

<HTML>
<HEAD><TITLE>Test for Long HTML files - using createElement DOM method</TITLE>
</HEAD>

<BODY>
<H2>This image, Ice Forest, will be displayed below 600 times.</H2>
<IMG SRC="ice_forest.gif" WIDTH="150" HEIGHT="100" BORDER="0" ALT="Forest Picture">
<P>START...</P>

<SCRIPT language=JavaScript>
  var myhead, myline, myhref, i;

 myhead = document.createElement("H2");
 document.body.appendChild( myhead );

for (i=0; i < 600 ; i++)
{
  // add dummy line
  myline = document.createElement("P");
  document.body.appendChild( myline );

  myimg = document.createElement("IMG");
  myimg.src= "ice_forest.gif";
  myimg.width= 150;
  myimg.height = 100;
  document.body.appendChild( myimg );

  myhref = document.createElement("A");
  myhref.href= "font.zip";
  myhref.innerHTML = "Image no " + i;
  document.body.appendChild( myhref );

}

</SCRIPT>
<P>FINISH...<BR>
You should see 600 images above</P>

</BODY>

</HTML>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic