Instead of absolutely positioning the close button, could this be changed as in the code below to be floated on the right?

This would then enable other buttons to be added and removed at will into a Dialog's "tools" area. If this change could be made, it would be easier to subclass BasicDialog to create more functional Window elements.

Not a huge change. Just a couple of extra elements needed. A div wrapper for the header text to float it left, and a wrapper for the buttons to form a "tools" element which is floated right:

In the constructor, just after declaring "dh" as shorthand for the DomHelper:

Remove the line which makes space for an absolutely positioned close button:

[code
.ydlg-closable .ydlg-hd{
padding-right:22px;
}
[/code]

When you make the dialog very narrow, and the title flows under the absolutely positioned "tools", you get about 1px of the title shining through to the right of the tools, but that's not very noticeable.

If necessary, you could position the tools right:0 and have {border-right:4px solid navy} It's just that alternat themes would also have to specify the right border color to obscure any long title.