Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubble percentage widths up while line breaking in CHTML. #1462

Merged
merged 1 commit into from
May 17, 2016

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented May 4, 2016

This fixes the multiple-tagged-equationwith-line-breaks issue that Peter reported in #1441 by making sure the line box gets width:100% when the line contains an item with 100% width.

@@ -348,6 +348,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
//
var node = this.CHTMLnodeElement();
line.appendChild(node);
if (this.CHTML.pwidth && !line.style.width) line.style.width = this.CHTML.pwidth;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also want to overwrite if line.style.width = 0?
Likewise if pwidth is 0 and width not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pwidth is a percentage width (a string), so always has a percent (and as a string, "0" is not falsey). Similarly, line.style.width will only be set (in this context) if it was set to a percent, and again, styles are always strings (even if set as numbers originally), so even width of 0 will be "0" and not false. In most browsers, 0 is changed to "0px" in any case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the pleasure of types...
So I assume none can be the empty string either?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when line.style.wodth has not been set, it will be an empty string (not null). That is the case we are testing for, here. Once it is set, it will be non-empty (either a percentage, or something with an explicit em or px measurement).

@pkra pkra added this to the MathJax v2.x.x milestone May 17, 2016
@zorkow
Copy link
Member

zorkow commented May 17, 2016

lgtm.

@dpvc dpvc merged commit fd22363 into mathjax:develop May 17, 2016
@dpvc dpvc deleted the issue1441 branch May 17, 2016 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants