Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#3515 closed defect (fixed)

dojo.marginBox returns different value under Safari/WebKit

Reported by: guest Owned by: sjmiles
Priority: high Milestone: 0.9beta
Component: HTML Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

Safari behaves differently when you set the width of a child div to be larger than the size of the parent div, and then do a dojo.marginBox on the child div.

In Moz and IE, dojo.marginBox will return the width that you set. (offsetWidth + 0 ) But in Safari, dojo.marginBox will return the cropped width. (offsetWidth + negative number) In my case, marginRight of the computed style is negative.

Attachments (2)

test_safari.html (2.1 KB) - added by guest 12 years ago.
test_safari_simple.html (824 bytes) - added by guest 12 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 12 years ago by guest

I believe we should ignore the negative number so the returned value is the same across browsers.

comment:2 Changed 12 years ago by bill

Scott wrote in another bug that it's only valid to do this if the parent div is overflow: hidden. Did you do that?

comment:3 Changed 12 years ago by guest

Yup, there's a overflow: hidden in the parent div.

Changed 12 years ago by guest

Attachment: test_safari.html added

comment:4 Changed 12 years ago by guest

You can see in the test case that IE and Mozilla both has 100 as the margin box width. But Safari has the original 76 as the margin box width.

Changed 12 years ago by guest

Attachment: test_safari_simple.html added

comment:5 Changed 12 years ago by bill

Owner: changed from Bryan Forbes to sjmiles

Sjmiles, can you take this one?

comment:6 Changed 12 years ago by sjmiles

Status: newassigned

comment:7 Changed 12 years ago by sjmiles

Resolution: fixed
Status: assignedclosed

As noted earlier, Safari's version of the computed right margin is the space between our right edge and the right edge of our offsetParent.

There is a bug filed on this here: http://bugs.webkit.org/show_bug.cgi?id=13343

Hack solution in html.js is to assume left/right margins are the same, which is committed in r9341, ref #3552.

comment:8 Changed 12 years ago by sjmiles

Resolution: fixed
Status: closedreopened
Summary: dojo.marginBox returns different value under Safari 3.02 Windowsdojo.marginBox returns different value under Safari/WebKit

The hack in r9341 breaks the unit tests.

comment:9 Changed 12 years ago by sjmiles

(In [9365]) Restrict Safari margin hack to nodes that are not position: absolute, allowing more tests to pass, refs #3515. Correct getMarginBox adjustment for Opera offsetLeft/Top, refs #3565.

comment:10 Changed 12 years ago by sjmiles

Resolution: fixed
Status: reopenedclosed

comment:11 Changed 8 years ago by bill

In [27852]:

Remove no-longer needed workaround code. Refs #3515, fixes #6728 !strict. Tested using test_safari_simple.html from #3515, plus dojo/tests/runTests.html, on chrome and safari.

Note: See TracTickets for help on using tickets.