(elem, optionsCopy)
| 265 | }; |
| 266 | |
| 267 | var renderElem = function renderElem(elem, optionsCopy) { |
| 268 | for (var i = 0; i < elem.childNodes.length; i++) { |
| 269 | var childNode = elem.childNodes[i]; |
| 270 | |
| 271 | if (childNode.nodeType === 3) { |
| 272 | // Text node |
| 273 | var frag = auto_render_renderMathInText(childNode.textContent, optionsCopy); |
| 274 | i += frag.childNodes.length - 1; |
| 275 | elem.replaceChild(frag, childNode); |
| 276 | } else if (childNode.nodeType === 1) { |
| 277 | (function () { |
| 278 | // Element node |
| 279 | var className = ' ' + childNode.className + ' '; |
| 280 | var shouldRender = optionsCopy.ignoredTags.indexOf(childNode.nodeName.toLowerCase()) === -1 && optionsCopy.ignoredClasses.every(function (x) { |
| 281 | return className.indexOf(' ' + x + ' ') === -1; |
| 282 | }); |
| 283 | |
| 284 | if (shouldRender) { |
| 285 | renderElem(childNode, optionsCopy); |
| 286 | } |
| 287 | })(); |
| 288 | } // Otherwise, it's something else, and ignore it. |
| 289 | |
| 290 | } |
| 291 | }; |
| 292 | |
| 293 | var renderMathInElement = function renderMathInElement(elem, options) { |
| 294 | if (!elem) { |
no test coverage detected