Make NativeMML attributes work the same as toMathML ones (makes sure href/style/etc are passed on properly).
This commit is contained in:
parent
05d2a862d5
commit
9fd243d9bd
|
@ -51,14 +51,14 @@ MathJax.Hub.Register.LoadHook("[MathJax]/jax/element/mml/jax.js",function () {
|
|||
},
|
||||
|
||||
toMathMLattributes: function () {
|
||||
var attr = [], defaults = this.defaults;
|
||||
var defaults = (this.type === "mstyle" ? MML.math.prototype.defaults : this.defaults);
|
||||
var names = (this.attrNames||MML.copyAttributeNames),
|
||||
skip = MML.skipAttributes, copy = MML.copyAttributes;
|
||||
var attr = [];
|
||||
|
||||
if (this.type === "math" && (!this.attr || !this.attr.xmlns))
|
||||
{attr.push('xmlns="http://www.w3.org/1998/Math/MathML"')}
|
||||
if (!this.attrNames) {
|
||||
if (this.type === "mstyle") {defaults = MML.math.prototype.defaults}
|
||||
for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
|
||||
if (this[id] != null && this[id] !== defaults[id]) {
|
||||
if (this.Get(id,null,1) !== this[id])
|
||||
|
|
|
@ -491,17 +491,18 @@
|
|||
//
|
||||
NativeMMLattributes: function (tag) {
|
||||
var defaults = (this.type === "mstyle" ? MML.math.prototype.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.attrNames) {
|
||||
for (var id in defaults) {if (!skip[id] && defaults.hasOwnProperty(id)) {
|
||||
if (this[id] != null && this[id] !== defaults[id]) {tag.setAttribute(id,this.NativeMMLattribute(this[id]))}
|
||||
for (var id in defaults) {if (!skip[id] && !copy[id] && defaults.hasOwnProperty(id)) {
|
||||
if (this[id] != null && this[id] !== defaults[id])
|
||||
tag.setAttribute(id,this.NativeMMLattribute(this[id]));
|
||||
}}
|
||||
}
|
||||
for (var i = 0, m = copy.length; i < m; i++) {
|
||||
if (defaults.hasOwnProperty(copy[i])) {
|
||||
var value = (this.attr||{})[copy[i]]; if (value == null) {value = this[copy[i]]}
|
||||
if (value != null) {tag.setAttribute(copy[i],this.NativeMMLattribute(value))}
|
||||
}
|
||||
for (var i = 0, m = names.length; i < m; i++) {
|
||||
if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
|
||||
var value = (this.attr||{})[names[i]]; if (value == null) {value = this[names[i]]}
|
||||
if (value != null) {tag.setAttribute(names[i],this.NativeMMLattribute(value))}
|
||||
}
|
||||
this.NativeMMLclass(tag);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user