Re: Help needed: document true width and height?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin Honnen

    Re: Help needed: document true width and height?

    VK wrote:
    Do current DOM implementations having any methods to get the document
    true width and height?
    Mozilla has
    document.height
    document.width
    IE has scrollHeight/scrollWidth, depending on compatMode you will need
    these properties of document.docume ntElement or document.body


    --

    Martin Honnen

  • GTalbot

    #2
    Re: Help needed: document true width and height?

    On 7 mai, 13:45, Martin Honnen <mahotr...@yaho o.dewrote:
    VK wrote:
    Do current DOM implementations having any methods to get the document
    true width and height?
    >
    Mozilla has
    document.height
    document.width
    Martin,

    as far as I know, document.width and document.height are not useful,
    helpful. One would instead/rather use
    window.innerWid th and window.innerHei ght for browsers that support
    these properties (Safari 2+, Firefox 1+, Seamonkey 1+, Opera 7+).

    Regards, Gérard


    Comment

    • GTalbot

      #3
      Re: Help needed: document true width and height?

      On 7 mai, 14:34, VK <schools_r...@y ahoo.comwrote:
      On May 7, 9:45 pm, Martin Honnen <mahotr...@yaho o.dewrote:
      Correction: scrollWidth / scrollHeight is
      supported by all current browsers of my interest, not by IE only.
      >
      document.docume ntElement.scrol lWidth
      document.docume ntElement.scrol lHeight
      seem to do what we need in Strict mode for FF 2.0.0.14, IE 6.0, Opera
      9.27 (tested under Windows XP SP2)
      Of course Safari 3.0 is broken : more basic feature one needs - more
      probability that Safari has a bug on it : this long standing tradition
      never got broken yet from my experience :-(
      Yes, you're right.
      document.docume ntElement.scrol lWidth
      document.docume ntElement.scrol lHeight
      is not correctly supported in Safari 3.1.1

      VK, why do you keep posting again and again the whole code of your
      webpage? Why not just post an URL?

      Regards, Gérard

      Comment

      • GTalbot

        #4
        Re: Help needed: document true width and height?

        On 7 mai, 14:06, GTalbot <newsgr...@gtal bot.orgwrote:
        On 7 mai, 13:45, Martin Honnen <mahotr...@yaho o.dewrote:
        >
        VK wrote:
        Do current DOM implementations having any methods to get the document
        true width and height?
        >
        Mozilla has
        document.height
        document.width
        >
        Martin,
        >
        as far as I know, document.width and document.height are not useful,
        helpful. One would instead/rather use
        window.innerWid th and window.innerHei ght for browsers that support
        these properties (Safari 2+, Firefox 1+, Seamonkey 1+, Opera 7+).
        >
        Regards, Gérard
        Sorry, I totally misread this. window.innerWid th and
        window.innerHei ght would give content area, client area, not whole
        document width and whole document height. Sorry again about that.

        Regards, Gérard

        Comment

        • VK

          #5
          Re: Help needed: document true width and height?

          On May 7, 10:49 pm, GTalbot <newsgr...@gtal bot.orgwrote:
          On 7 mai, 14:34, VK <schools_r...@y ahoo.comwrote:
          >
          On May 7, 9:45 pm, Martin Honnen <mahotr...@yaho o.dewrote:
          Correction: scrollWidth / scrollHeight is
          supported by all current browsers of my interest, not by IE only.
          >
          document.docume ntElement.scrol lWidth
          document.docume ntElement.scrol lHeight
          seem to do what we need in Strict mode for FF 2.0.0.14, IE 6.0, Opera
          9.27 (tested under Windows XP SP2)
          Of course Safari 3.0 is broken : more basic feature one needs - more
          probability that Safari has a bug on it : this long standing tradition
          never got broken yet from my experience :-(
          >
          Yes, you're right.
          document.docume ntElement.scrol lWidth
          document.docume ntElement.scrol lHeight
          is not correctly supported in Safari 3.1.1
          >
          VK, why do you keep posting again and again the whole code of your
          webpage? Why not just post an URL?
          >
          Regards, Gérard
          First of all sorry for that.
          Besides my customers' websites in development which I'd like do not
          use for personal purposes out of obvious considerations - besides that
          I have my Yahoo! personal page but because of auto-insertions Yahoo!
          does it is not possible to get Strict mode for the page.

          Sourceforge just approved TransModal project for hosting, so I'm going
          to use it for further test postings. Their SSH / SFTP setup procedure
          is the most convoluted in the Web world-wide, I know it since JSONet
          project, so I cannot do it right at this second as at this second I
          have not a second, really.

          Just copy, paste into text file, save as anything.html, open in your
          browser. I agree it is not as easy as to click a link, but right at
          this moment one could donate extra 15-30sec of their time to save me
          an hour (?)

          Comment

          • VK

            #6
            Re: Help needed: document true width and height?

            On May 7, 10:49 pm, GTalbot <newsgr...@gtal bot.orgwrote:
            document.docume ntElement.scrol lWidth
            document.docume ntElement.scrol lHeight
            is not correctly supported in Safari 3.1.1
            document.docume ntElement.scrol lHeight in Strict works fine. The broken
            feature is document.docume ntElement.scrol lWidth that seems to work as
            a plain alias to document.docume ntElement.conte ntWidth (see the posted
            sample)

            Overall it is a 10 years old mystery to me why all size-related
            methods are targeted to work with the viewport which is rarely of
            anyone interest - and nearly useless for the actual HTML container
            sizing itself which is what in ~ 90% of cases one needs to know. A
            wild guess would be the programmer's laziness: it is a trivia to get
            current values from the application window and it is much more hard to
            write an algorithm for container size calculations.

            Any way I guess we'll stick for now with
            document.docume ntElement.scrol lWidth
            document.docume ntElement.scrol lHeight
            and see if they are still usable for the standard border-box box
            model.

            And Safari just has to keep trying to become a modern browser. One day
            they may finally succeed though the chances are getting lower every
            year onward.

            Comment

            • GTalbot

              #7
              Re: Help needed: document true width and height?

              On 7 mai, 18:13, VK <schools_r...@y ahoo.comwrote:

              Any way I guess we'll stick for now with
              document.docume ntElement.scrol lWidth
              document.docume ntElement.scrol lHeight
              and see if they are still usable for the standard border-box box
              model.
              >
              And Safari just has to keep trying to become a modern browser. One day
              they may finally succeed though the chances are getting lower every
              year onward.
              VK,
              you can file a bug for support of
              document.docume ntElement.scrol lWidth
              document.docume ntElement.scrol lHeight
              at


              Regards, Gérard

              Comment

              • VK

                #8
                Re: Help needed: document true width and height?

                On May 8, 3:16 am, GTalbot <newsgr...@gtal bot.orgwrote:
                On 7 mai, 18:13, VK <schools_r...@y ahoo.comwrote:
                >
                Any way I guess we'll stick for now with
                document.docume ntElement.scrol lWidth
                document.docume ntElement.scrol lHeight
                and see if they are still usable for the standard border-box box
                model.
                >
                And Safari just has to keep trying to become a modern browser. One day
                they may finally succeed though the chances are getting lower every
                year onward.
                >
                VK,
                you can file a bug for support of
                document.docume ntElement.scrol lWidth
                document.docume ntElement.scrol lHeight
                at https://bugs.webkit.org/index.cgi?GoAheadAndLogIn=1
                Maybe some later - or you are welcome to do it on my behalf - I am not
                so concerned about bug copyrights :-)

                With all these offset/content/scroll Width/Height/Top/Left one may get
                quickly exhausted by filing bugs to different UA producers. It just
                happened that scrollWhatever is broken for Safari but "only" buggy on
                others. IMO the best would be to trash out all these properties all
                together as no one reliably does what claimed and never did ever since
                IE4/NN4. Instead I would file a bug to W3C, CC to Microsoft and
                Mozilla asking to stop this nonsense and to define

                .trueWidth
                true width of the container if it would be shown
                without scrollbars

                .trueHeight
                true height of the container if it would be shown
                without scrollbars

                .viewportWidth
                the width of the container currently shown

                .viewportHeight
                the height of the container currently shown

                .absoluteX
                X distance from the trueWidth left border in px

                .absoluteY
                Y distance from the trueHeight right border in px

                .vewportX
                X distance from the viewport left border in px

                .vewportY
                Y distance from the viewport right border in px

                Yes, I know - silly dreams. But can we dream at least sometimes...

                Comment

                • GTalbot

                  #9
                  Re: Help needed: document true width and height?

                  On 7 mai, 19:32, VK <schools_r...@y ahoo.comwrote:

                  [snipped]
                  With all these offset/content/scroll Width/Height/Top/Left one may get
                  quickly exhausted by filing bugs to different UA producers. It just
                  happened that scrollWhatever is broken for Safari but "only" buggy on
                  others.
                  I have checked several of my webpages and it's not clear.

                  DHTML object model properties


                  Safari 3.1.1 for windows supports everything, except maybe clientLeft
                  when the direction is rtl (and even there, D. Hyatt told me that in
                  Mac, the scrollbar is always on the left; in Windows, it's different).
                  Do this: scroll all the way down and calculate clientHeight plus
                  scrollTop and it will give you the scrollHeight value. So, the
                  implementation is correct. I double-checked when increasing font-size.

                  scrollHeight for document.docume ntElement is correctly reported at

                  You have to click twice the DOCUMENT.DOCUME NTELEMENT button because
                  the generated content affects the scrollHeight property as it
                  populates document content box with the text of properties and
                  methods.
                  scrollHeight is at position 82 in the generated list.

                  document.docume ntElement.scrol lHeight does not seem to be correctly
                  reported at

                  I think - just a guess - it misses absolutely positioned blocks (which
                  must be taken out of normal flow) and only considers static blocks...
                  This may be a bug... depends on how you define scrollHeight for the
                  root element.
                  IMO the best would be to trash out all these properties all
                  together as no one reliably does what claimed and never did ever since
                  IE4/NN4. Instead I would file a bug to W3C, CC to Microsoft and
                  Mozilla asking to stop this nonsense and to define
                  >
                  .trueWidth
                  true width of the container if it would be shown
                  without scrollbars
                  >
                  .trueHeight
                  true height of the container if it would be shown
                  without scrollbars
                  >
                  .viewportWidth
                  the width of the container currently shown
                  >
                  .viewportHeight
                  the height of the container currently shown
                  >
                  .absoluteX
                  X distance from the trueWidth left border in px
                  >
                  .absoluteY
                  Y distance from the trueHeight right border in px
                  >
                  .vewportX
                  X distance from the viewport left border in px
                  >
                  .vewportY
                  Y distance from the viewport right border in px
                  >
                  Yes, I know - silly dreams. But can we dream at least sometimes...
                  Why start all over when things have already been defined:
                  W3C CSSOM View Module (Draft)


                  Regards, Gérard

                  Comment

                  Working...