Have Update() method ask ElementJax to determine if it needs updating (which in turn asks the associated input jax). Make Remove() work for just clearing output (without detaching) if desired.
This commit is contained in:
parent
944aed1ac1
commit
fa7673e03d
File diff suppressed because one or more lines are too long
|
@ -1358,15 +1358,12 @@ MathJax.Hub = {
|
||||||
Process: function (script) {},
|
Process: function (script) {},
|
||||||
Update: function (script) {
|
Update: function (script) {
|
||||||
var jax = script.MathJax.elementJax;
|
var jax = script.MathJax.elementJax;
|
||||||
// FIXME: Have intputJax determine if things have changed?
|
if (jax && jax.needsUpdate()) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE}
|
||||||
if (jax && jax.originalText === (script.text == "" ? script.innerHTML : script.text))
|
else {script.MathJax.state = jax.STATE.PROCESSED}
|
||||||
{script.MathJax.state = jax.STATE.PROCESSED} else
|
|
||||||
{MathJax.OutputJax[jax.outputJax].Remove(jax); script.MathJax.state = jax.STATE.UPDATE}
|
|
||||||
},
|
},
|
||||||
Reprocess: function (script) {
|
Reprocess: function (script) {
|
||||||
var jax = script.MathJax.elementJax;
|
var jax = script.MathJax.elementJax;
|
||||||
if (jax)
|
if (jax) {jax.Remove(true); script.MathJax.state = jax.STATE.UPDATE}
|
||||||
{MathJax.OutputJax[jax.outputJax].Remove(jax); script.MathJax.state = jax.STATE.UPDATE}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1856,6 +1853,10 @@ MathJax.Hub.Startup = {
|
||||||
if (jax) {queue.Push(AJAX.Require(jax[0].directory+"/"+this.JAXFILE))}
|
if (jax) {queue.Push(AJAX.Require(jax[0].directory+"/"+this.JAXFILE))}
|
||||||
return queue.Push({});
|
return queue.Push({});
|
||||||
},
|
},
|
||||||
|
needsUpdate: function (jax) {
|
||||||
|
var script = jax.SourceElement();
|
||||||
|
return (jax.originalText !== (script.text == "" ? script.innerHTML : script.text));
|
||||||
|
},
|
||||||
Register: function (mimetype) {
|
Register: function (mimetype) {
|
||||||
if (!HUB.inputJax) {HUB.inputJax = {}}
|
if (!HUB.inputJax) {HUB.inputJax = {}}
|
||||||
HUB.inputJax[mimetype] = this;
|
HUB.inputJax[mimetype] = this;
|
||||||
|
@ -1917,10 +1918,15 @@ MathJax.Hub.Startup = {
|
||||||
script.MathJax.state = this.STATE.OUTPUT;
|
script.MathJax.state = this.STATE.OUTPUT;
|
||||||
return HUB.Process(script,callback);
|
return HUB.Process(script,callback);
|
||||||
},
|
},
|
||||||
Remove: function () {
|
Remove: function (keep) {
|
||||||
MathJax.OutputJax[this.outputJax].Remove(this);
|
BASE.OutputJax[this.outputJax].Remove(this);
|
||||||
HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
|
if (!keep) {
|
||||||
this.Detach();
|
HUB.signal.Post(["Remove Math",this.inputID]); // wait for this to finish?
|
||||||
|
this.Detach();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
needsUpdate: function () {
|
||||||
|
return BASE.InputJax[this.inputJax].needsUpdate(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
SourceElement: function () {return document.getElementById(this.inputID)},
|
SourceElement: function () {return document.getElementById(this.inputID)},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user