Make displaystyle and scriptlevel be forced only if they are in the list of default properties. Resolves issue #912 better than before.
This commit is contained in:
parent
e0a81d5f7c
commit
69a57f4da4
|
@ -52,13 +52,14 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
|
||||||
|
|
||||||
toMathMLattributes: function () {
|
toMathMLattributes: function () {
|
||||||
var attr = [], defaults = this.defaults;
|
var attr = [], defaults = this.defaults;
|
||||||
var copy = (this.attrNames||MML.copyAttributeNames), skip = MML.skipAttributes;
|
var names = (this.attrNames||MML.copyAttributeNames),
|
||||||
|
skip = MML.skipAttributes, copy = MML.copyAttributes;
|
||||||
|
|
||||||
if (this.type === "math" && (!this.attr || !this.attr.xmlns))
|
if (this.type === "math" && (!this.attr || !this.attr.xmlns))
|
||||||
{attr.push('xmlns="http://www.w3.org/1998/Math/MathML"')}
|
{attr.push('xmlns="http://www.w3.org/1998/Math/MathML"')}
|
||||||
if (!this.attrNames) {
|
if (!this.attrNames) {
|
||||||
if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
|
if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
|
||||||
for (var id in defaults) {if (!skip[id] && defaults.hasOwnProperty(id)) {
|
for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
|
||||||
if (this[id] != null && this[id] !== defaults[id]) {
|
if (this[id] != null && this[id] !== defaults[id]) {
|
||||||
var value = this[id]; delete this[id];
|
var value = this[id]; delete this[id];
|
||||||
if (this.Get(id) !== value) {attr.push(id+'="'+this.toMathMLattribute(value)+'"')}
|
if (this.Get(id) !== value) {attr.push(id+'="'+this.toMathMLattribute(value)+'"')}
|
||||||
|
@ -66,10 +67,10 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
for (var i = 0, m = copy.length; i < m; i++) {
|
for (var i = 0, m = names.length; i < m; i++) {
|
||||||
if (copy[i] === "class") continue; // this is handled separately below
|
if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
|
||||||
value = (this.attr||{})[copy[i]]; if (value == null) {value = this[copy[i]]}
|
value = (this.attr||{})[names[i]]; if (value == null) {value = this[names[i]]}
|
||||||
if (value != null) {attr.push(copy[i]+'="'+this.toMathMLquote(value)+'"')}
|
if (value != null) {attr.push(names[i]+'="'+this.toMathMLquote(value)+'"')}
|
||||||
}
|
}
|
||||||
this.toMathMLclass(attr);
|
this.toMathMLclass(attr);
|
||||||
if (attr.length) {return " "+attr.join(" ")} else {return ""}
|
if (attr.length) {return " "+attr.join(" ")} else {return ""}
|
||||||
|
|
|
@ -214,12 +214,15 @@ MathJax.ElementJax.mml.Augment({
|
||||||
NONE: -1
|
NONE: -1
|
||||||
},
|
},
|
||||||
TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", "INNER", "VCENTER"],
|
TEXCLASSNAMES: ["ORD", "OP", "BIN", "REL", "OPEN", "CLOSE", "PUNCT", "INNER", "VCENTER"],
|
||||||
|
skipAttributes: {
|
||||||
|
texClass:true, useHeight:true, texprimestyle:true
|
||||||
|
},
|
||||||
copyAttributes: {
|
copyAttributes: {
|
||||||
|
displaystyle:1, scriptlevel:1, open:1, close:1, form:1,
|
||||||
fontfamily:true, fontsize:true, fontweight:true, fontstyle:true,
|
fontfamily:true, fontsize:true, fontweight:true, fontstyle:true,
|
||||||
color:true, background:true,
|
color:true, background:true,
|
||||||
id:true, "class":true, href:true, style:true
|
id:true, "class":1, href:true, style:true
|
||||||
},
|
},
|
||||||
skipAttributes: {texClass: true, useHeight: true, texprimestyle: true},
|
|
||||||
copyAttributeNames: [
|
copyAttributeNames: [
|
||||||
"displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied
|
"displaystyle", "scriptlevel", "open", "close", "form", // force these to be copied
|
||||||
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
"fontfamily", "fontsize", "fontweight", "fontstyle",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user