Opened 7 years ago

Last modified 2 years ago

#15104 assigned enhancement

auto-detect border-box box model

Reported by: eschiebel Owned by: bill
Priority: undecided Milestone: 1.15
Component: HTML Version: 1.7.2
Keywords: Cc: ben hockey
Blocked By: Blocking:


setMarginBox has incorrect results on an element with box-sizing: border-box,

in firefox 10, shrinks the box by the size of padding + border in chrome 19, it also moves the box.

open the attached file in a browser and call box("a") through box("c") in the console.

Attachments (1)

d.html (928 bytes) - added by eschiebel 7 years ago.
test page

Download all attachments as: .zip

Change History (9)

Changed 7 years ago by eschiebel

Attachment: d.html added

test page

comment:1 Changed 7 years ago by ben hockey

Cc: ben hockey added

comment:2 Changed 7 years ago by bill

Component: GeneralHTML
Owner: set to Eugene Lazutkin

comment:3 Changed 7 years ago by bill

May need to fix this for #14931.

comment:4 Changed 6 years ago by bill

Summary: setMarginBox incorrect with box-sizing:border-boxauto-detect border-box box model
Type: defectenhancement

With the current code, if you have box-model box sizing for the page you need to manually tell dom-geometry that you are using it, via something like:

require("dojo/dom-geometry").boxModel = "border-box";

Putting the above line in themeTester.html seems to work.

The alternatives would be:

  1. Test <body> or some other node on page startup to see its box model. In user code this is done like:
if(domStyle.get(document.body, "boxSizing") == "border-box" ||
		domStyle.get(document.body, "MozBoxSizing") == "border-box"){
	domGeom.boxModel = "border-box";
  1. automatically detect the sizing for each node, on every call to setMarginBox() etc. Not sure of the performance implications though; it might cause too much of a performance degradation.

Changing this ticket to an enhancement about those two options.

Last edited 6 years ago by bill (previous) (diff)

comment:5 Changed 6 years ago by bill

#14931 is a duplicate of this ticket.

comment:6 Changed 6 years ago by bill

In [30685]:

code to test border-box sizing, refs #14931, #15104

comment:7 Changed 3 years ago by dylan

Milestone: tbd1.12
Owner: changed from Eugene Lazutkin to bill
Status: newassigned

Bill is this still an issue? If so, is it worth fixing, or close as patchwelcome?

comment:8 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.