'wrap' inconsistency? createElement VS document.write

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pieter Van Waeyenberge

    'wrap' inconsistency? createElement VS document.write

    Hello,

    im some image elements using doc.createEleme nt('IMG');
    i set the following styles:
    - for the images container: white-space:normal;
    - for the images themselves: display: inline;

    i append the images to the body ... but the imagery dont wrap when the
    window gets smaller, unless i append a space (createTextNode ) after each
    image

    HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
    src="" ...> it wraps fine


    Is this normal??

    Pieter



  • Martin Honnen

    #2
    Re: 'wrap' inconsistency? createElement VS document.write



    Pieter Van Waeyenberge wrote:

    [color=blue]
    > im some image elements using doc.createEleme nt('IMG');
    > i set the following styles:
    > - for the images container: white-space:normal;
    > - for the images themselves: display: inline;
    >
    > i append the images to the body ... but the imagery dont wrap when the
    > window gets smaller, unless i append a space (createTextNode ) after each
    > image
    >
    > HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
    > src="" ...> it wraps fine
    >
    >
    > Is this normal??[/color]

    Write a small test case demonstrating the problem, post a URL and tell
    us which browser(s) exhibit the problem. Then someone can better give an
    opinion on why that occurs or shouldn't occur.

    --

    Martin Honnen


    Comment

    • Pieter Van Waeyenberge

      #3
      Re: 'wrap' inconsistency? createElement VS document.write

      sorry, some more detail:
      (i dont have URL handy and the whole script is too complex to post it here)

      i only tested on most recent NS & IE, and the code behaves the same ...

      SCENARIO 1: images do NOT wrap
      --------------------------------------
      <script>
      onload = function(){
      var foo = document.create Element('IMG');
      foo.src = 'foo.jpg';

      var goo = document.create Element('IMG');
      goo.src = 'goo.jpg';

      var myBody = document.getEle mentsByName('BO DY');
      myBody = myBody.item(0);

      myBody.appendCh ild(foo);
      myBody.appendCh ild(goo);
      }
      </script>
      <body>
      </body>

      SCENARIO 2: images wrap
      --------------------------------------
      <body>
      <img src="foo"><img src="goo">
      </body>

      Remark: i also tried putting the images of SCENARIO 1 in a container with
      'white-space:normal;' and the images themselves 'display:inline ;' ... still
      no wrapping when flow should go to next line, instead i get scrollbar and
      all on one line ... unlike in SCENARIO 2

      However, in SCENARIO 1, i obtain wrapping when i explicitly add some
      white-space after every image ... sounds logical, but in SCENARIO 2 theres
      no whtespace between the images so i find it inconsistent?

      I hope this is more clear ....
      Pieter.



      "Martin Honnen" <mahotrash@yaho o.de> wrote in message
      news:4027cb95$1 @olaf.komtel.ne t...[color=blue]
      >
      >
      > Pieter Van Waeyenberge wrote:
      >
      >[color=green]
      > > im some image elements using doc.createEleme nt('IMG');
      > > i set the following styles:
      > > - for the images container: white-space:normal;
      > > - for the images themselves: display: inline;
      > >
      > > i append the images to the body ... but the imagery dont wrap when the
      > > window gets smaller, unless i append a space (createTextNode ) after each
      > > image
      > >
      > > HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
      > > src="" ...> it wraps fine
      > >
      > >
      > > Is this normal??[/color]
      >
      > Write a small test case demonstrating the problem, post a URL and tell
      > us which browser(s) exhibit the problem. Then someone can better give an
      > opinion on why that occurs or shouldn't occur.
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/
      >[/color]


      Comment

      • Pieter Van Waeyenberge

        #4
        Re: 'wrap' inconsistency? createElement VS document.write

        ignore this thread .. i didnt set whitespace = normal explicitly in the
        containing elemnt

        pieter.

        "Pieter Van Waeyenberge" <p@foo.com> wrote in message
        news:4027c6ed$0 $319$ba620e4c@n ews.skynet.be.. .[color=blue]
        > Hello,
        >
        > im some image elements using doc.createEleme nt('IMG');
        > i set the following styles:
        > - for the images container: white-space:normal;
        > - for the images themselves: display: inline;
        >
        > i append the images to the body ... but the imagery dont wrap when the
        > window gets smaller, unless i append a space (createTextNode ) after each
        > image
        >
        > HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
        > src="" ...> it wraps fine
        >
        >
        > Is this normal??
        >
        > Pieter
        >
        >
        >[/color]


        Comment

        Working...