commit 39109bf88a1a4a04d1c1f109eb8c44cf75f2ea13
parent 1228bb89ad5c9ffb307dee22ed0d1814e378a4d5
Author: zorkow <volker.sorge@gmail.com>
Date: Wed, 26 Aug 2015 13:56:30 +0100
Removes caching of MathJax nodes.
Diffstat:
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js
@@ -477,26 +477,22 @@
/*
* Keyboard navigation of menu.
*/
- jaxs: [], // List of all MathJax nodes.
- hasJaxs: false, // Flag to indicate if the MathJax node list has already
- // been computed.
node: null, // The node the menu was activated on. HTML!
active: null, // The currently focused item. There can only be one! HTML!
posted: false, // Is a menu open?
GetJaxs: function() {
- if (MENU.hasJaxs) {
- return MENU.jaxs;
+ var jaxs = MathJax.Hub.getAllJax();
+ var nodes = [];
+ for (var i = 0, jax; jax = jaxs[i]; i++) {
+ var node = document.getElementById(jax.inputID + "-Frame");
+ nodes.push(node.isMathJax ? node : node.firstChild);
}
- var nodes = document.getElementsByClassName('MathJax');
- for (var i = 0, node; node = nodes[i]; i++) {
- MENU.jaxs.push(node);
- }
- MENU.hasJaxs = true;
- return MENU.jaxs;
+ return nodes;
},
GetNode: function() {
- return MENU.node;
+ return document.getElementById(MENU.jax.inputID + '-Frame');
+ // return MENU.node;
},
SetNode: function(node) {
MENU.node = node;
@@ -525,7 +521,8 @@
if (!MENU.GetNode()) {
MENU.SetNode(document.getElementById(MENU.jax.inputID + '-Frame'));
}
- for (var j = 0, jax; jax = MENU.GetJaxs()[j]; j++) {
+ var jaxs = MENU.GetJaxs();
+ for (var j = 0, jax; jax = jaxs[j]; j++) {
jax.tabIndex = -1;
}
MENU.posted = true;