Menu

#133 dimensions patch for IE6 using doctypes

open
None
5
2001-11-04
2001-11-03
Andy Short
No

When looking for the bodys width/height in IE6 using:

DynAPI.document.getWidth()
DynAPI.document.getHeight()

if the document has a valid doctype either XHTML or 4 +
IE6 runs in a CSS1 compatible strict mode when certain
doctypes are present. In that case the documentElement
represents the canvas, not the body element therefore
findimensions() was returning 0 using
this.doc.body.clientHeight and a strict/xhtml doctype

added a check for wether the document was in
strictmode or not and used
this.doc.documentElement.clientHeight

basically if you write HTML or XHTML using doctypes
and you use the documents body's width/height in your
code you will need this for correct display in IE6

Discussion

  • Andy Short

    Andy Short - 2001-11-03

    replacement dyndocument.js

     
  • Richard Bennett

    Richard Bennett - 2001-11-04

    Logged In: YES
    user_id=164855

    Hi,
    Have you any idea if IE5/MAC has the same difference when
    running under "strict" mode?
    I added a test for this in the /tests directory in CVS,
    here:
    <wrap>
    http://cvs.sourceforge.net/cgi-
    bin/viewcvs.cgi/~checkout~/dynapi/dynapi/tests/doctype_clien
    tHeight.html?rev=HEAD&content-type=text/html
    </wrap>

    Wouldn't it be best to do the doctype-sniffing in
    browser.js?
    If so, like this:
    if(is.strict&&is.IE6)
    or like this? :
    if(is.IE6Strict)?

    Richard.

     
  • Richard Bennett

    Richard Bennett - 2001-11-04
    • assigned_to: nobody --> richard_bennett
     
  • Andy Short

    Andy Short - 2001-11-05

    Logged In: YES
    user_id=176079

    With regard to the strict mode on a mac, not having access
    to a mac i couldnt test this behaviour in ie5 , i believe
    this behaviour only applies to ie6.

    re the check, i put the check within the dyndocument to try
    and keep the change to one file, it might be worth adding
    this check to the browser.js and use if(is.ie6strict)
    method as mozilla isnt affected and believed ie5 on a mac
    isnt either, tho this should really be confirmed before
    committing these changes to the cvs.

    thanks
    ... sh0rtie

     
  • martin ström

    martin ström - 2001-11-05

    Logged In: YES
    user_id=46384

    i've tested on mac ie5:

    document.body.clientHeight = 466
    document.compatMode = undefined
    document.documentElement.clientHeight = undefined

    which leads to this is ie6 only.

    i think a is.strict is best while other browsers
    go into strict mode aswell, and then we can use
    is.strict to identify different modes.

     
  • Richard Bennett

    Richard Bennett - 2001-11-05

    Logged In: YES
    user_id=164855

    Thanks for testing that.

    <<i think a is.strict is best while other browsers
    <<go into strict mode aswell, and then we can use
    <<is.strict to identify different modes.

    That would mean we would have to do if (is.strict&&is.IE6)
    Is that the best way?
    Bear in mind that the code to test for strict mode in
    IE5/Mac, and Mozilla is a lot more involved than for IE6.
    Should we add all that in now, or just the IE6 part to
    start with?

    Also, I noticed that HEX colors have to be started with the
    # sign, or they don't show in IE6 Strict mode.
    Something else to keep in mind.

     
  • martin ström

    martin ström - 2001-11-12

    Logged In: YES
    user_id=46384

    if this.strict could test for mozilla's strict mode aswell
    i think this would be the best.

    can't we use the test you had on
    http://www.richardinfo.com/case_studies/doctypes.html

    to detect which mode ie5mac, ie6 or mozilla is in?
    and add this to browser.js

     
  • Max Nokhrin

    Max Nokhrin - 2002-01-22

    Logged In: YES
    user_id=373738

    THANK YOU THANK YOU THANK YOU!!!

    There is also a bug in IE6 that returned an incorrect
    clientHeight and clientWidth. Your file fixes that error!

    Thank you very much!

     
  • Nobody/Anonymous

    Logged In: NO

    The Alert box reads:

    document.body.clientHeight = 438
    document.compatMode = undefined
    document.documentElement.clientHeight = undefined

    Using IE 5.2.1 for Mac OS X 10.1.5 on
    an iMac at 800 x 600 screen resolution

     
  • Nobody/Anonymous

    Logged In: NO

    Mac os 10.2, IE 5.2.2...

    document.body.clientHeight = 629
    document.compatMode = undefined
    document.documentElement.clientHeight = undefined

    629 is in fact the height of the window's rendering area.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.