Loading ...
Sorry, an error occurred while loading the content.
 

Confirmation of correct getBBox() behavior?

Expand Messages
  • brucerindahl
    I am getting different results in various browsers in the getBBox() function. Using the code:
    Message 1 of 4 , Dec 3, 2007
      I am getting different results in various browsers in the getBBox()
      function. Using the code:

      <svg xmlns="http://www.w3.org/2000/svg"
      onload="g_onload()">

      <defs>
      <script>
      <![CDATA[

      function g_onload() {
      var test = document.getElementById("test")
      var bbox = test.getBBox()
      alert("x="+bbox.x+" y="+bbox.y+" width="+bbox.width+"
      height="+bbox.height)
      }

      ]]>
      </script>
      </defs>

      <g id="test" >
      <rect x="10" y="10" width="25" height="10" />
      <g display="none" >
      <rect x="10" y="20" width="50" height="10" />
      </g>
      </g>
      </svg>

      to test, I think the second rectangle should not be computed in the
      BBox because of the display="none" attribute so the results in the
      alert box should read: "x=10 y=10 width=25 height=10"

      Result 2 is "x=10 y=10 width=50 height=20" when the second rectangle
      is also computed.

      Which is correct?

      Current results:
      IE/ASV Result 2
      Opera Result 2
      Safari Result 1
      Mozilla Result 1
      Batik Result 1

      Thanks!
      Bruce
    • Erik Dahlström
      ... That is the result I get in Opera 9.2x and 9.5, Safari 3, Firefox 3, Batik 1.7. ... Result 1 AFAIK. ... Strange that you get a different result here, do
      Message 2 of 4 , Dec 3, 2007
        On Mon, 03 Dec 2007 22:29:40 +0100, brucerindahl <rindahl@...> wrote:

        > I am getting different results in various browsers in the getBBox()
        > function. Using the code:
        >
        > <svg xmlns="http://www.w3.org/2000/svg"
        > onload="g_onload()">
        >
        > <defs>
        > <script>
        > <![CDATA[
        >
        > function g_onload() {
        > var test = document.getElementById("test")
        > var bbox = test.getBBox()
        > alert("x="+bbox.x+" y="+bbox.y+" width="+bbox.width+"
        > height="+bbox.height)
        > }
        >
        > ]]>
        > </script>
        > </defs>
        >
        > <g id="test" >
        > <rect x="10" y="10" width="25" height="10" />
        > <g display="none" >
        > <rect x="10" y="20" width="50" height="10" />
        > </g>
        > </g>
        > </svg>
        >
        > to test, I think the second rectangle should not be computed in the
        > BBox because of the display="none" attribute so the results in the
        > alert box should read: "x=10 y=10 width=25 height=10"

        That is the result I get in Opera 9.2x and 9.5, Safari 3, Firefox 3, Batik
        1.7.

        > Result 2 is "x=10 y=10 width=50 height=20" when the second rectangle
        > is also computed.
        >
        > Which is correct?

        Result 1 AFAIK.

        > Current results:
        > IE/ASV Result 2
        > Opera Result 2

        Strange that you get a different result here, do you have any more data?
        Like Opera version+buildnumber, platform and OS version?

        Cheers
        /Erik

        --
        Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
      • brucerindahl
        ... Batik ... data? ... Major screwup on my part! I meant to say Opera gives Result 1. I was testing on the various platforms and the client uses IE/ASV so I
        Message 3 of 4 , Dec 3, 2007
          --- In svg-developers@yahoogroups.com, Erik Dahlström <ed@...> wrote:
          >
          > On Mon, 03 Dec 2007 22:29:40 +0100, brucerindahl <rindahl@...> wrote:
          >
          > > I am getting different results in various browsers in the getBBox()
          > > function. Using the code:
          > >
          > > <svg xmlns="http://www.w3.org/2000/svg"
          > > onload="g_onload()">
          > >
          > > <defs>
          > > <script>
          > > <![CDATA[
          > >
          > > function g_onload() {
          > > var test = document.getElementById("test")
          > > var bbox = test.getBBox()
          > > alert("x="+bbox.x+" y="+bbox.y+" width="+bbox.width+"
          > > height="+bbox.height)
          > > }
          > >
          > > ]]>
          > > </script>
          > > </defs>
          > >
          > > <g id="test" >
          > > <rect x="10" y="10" width="25" height="10" />
          > > <g display="none" >
          > > <rect x="10" y="20" width="50" height="10" />
          > > </g>
          > > </g>
          > > </svg>
          > >
          > > to test, I think the second rectangle should not be computed in the
          > > BBox because of the display="none" attribute so the results in the
          > > alert box should read: "x=10 y=10 width=25 height=10"
          >
          > That is the result I get in Opera 9.2x and 9.5, Safari 3, Firefox 3,
          Batik
          > 1.7.
          >
          > > Result 2 is "x=10 y=10 width=50 height=20" when the second rectangle
          > > is also computed.
          > >
          > > Which is correct?
          >
          > Result 1 AFAIK.
          >
          > > Current results:
          > > IE/ASV Result 2
          > > Opera Result 2
          >
          > Strange that you get a different result here, do you have any more
          data?
          > Like Opera version+buildnumber, platform and OS version?
          >
          > Cheers
          > /Erik
          >
          > --
          > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
          >
          Major screwup on my part! I meant to say Opera gives Result 1.
          I was testing on the various platforms and the client uses IE/ASV so I
          was getting different results.
          Sorry about the confusion.
          Bruce
        • longsonr
          ... This is a known bug in ASV see http://wiki.svg.org/Known_Bugs#Bounding_Box_and_display:none_Bug Best regards Robert
          Message 4 of 4 , Dec 4, 2007
            --- In svg-developers@yahoogroups.com, "brucerindahl" <rindahl@...> wrote:

            This is a known bug in ASV see

            http://wiki.svg.org/Known_Bugs#Bounding_Box_and_display:none_Bug

            Best regards

            Robert
          Your message has been successfully submitted and would be delivered to recipients shortly.