jquery - jQMath - Elementary math Sum line equivalent in MathML -


i know general lower math not supported in jqmath, , i’ve created small work around using css , jquery adds border bottom of table cell. works fine in chrome, ie , safari use fmath (fake math) represent mathml tables, in firefox, uses native mathml markup, not supported. in fact, can’t seem use jquery add class elements @ all, though i’m finding them fine. being said, there setting allow me force firefox (or other browsers) use fake math tables until better supported browser? or, there way don’t know of allow me add sum line native mathml source?

some code thought:

<div class=”row math”> <div class=”col2”> <p><strong>first equation</strong></p> $\\table x + y,=,9; \cl "red"{6}+ y,=,9; 6 + y,=,9; \cl "math-sum red redunderline" {-6},\cl "math-sum redunderline" {&nbsp;}, \cl "math-sum red redunderline" {-6}; y,=,\cl "red" {3};$ <br/> <p> solution system <br />   x = 6, y = 3.</p> </div> <div class=”col2”> $\table x - y,=,3; \cl "red" {6}- y,=,3; 6 + y,=,9; \cl "redunderline math-sum red"{-6},,\cl "redunderline math-sum red"{-6}; -y,=,\cl "red" {-3}; y,=,\cl "red" {3};$ <br> <p> solution system <br />   x = 6, y = 3.</p> </div> </div> 

css handle underlines

<style type=”text/css”> /* jqmath using important tags requires important override contents inside css file*/ .math .math-sum.red, .redunderline {      border-bottom: #a20000 1px solid !important;  } </style> 

jquery move underline:

// add red underline jqmath fake table markup if($('td.fm-mtd:has(.red.math-sum)').selector === 'td.fm-mtd:has(.red.math-sum)') {     $('td.fm-mtd:has(.red.math-sum)').addclass('redunderline'); } if($('td.fm-mtd:has(.red.math-sum-row)').selector === 'td.fm-mtd:has(.red.math-sum-row)') {     $('td.fm-mtd:has(.red.math-sum-row)').parent().addclass('redunderline'); }  if($('td.fm-mtd.mrow:has(.red.math-sum-row)').selector === 'td.fm-mtd.mrow:has(.red.math-sum-row)') {     $('td.fm-mtd:has(.red.math-sum-row)').parent().addclass('redunderline'); }   // add red underline real math table markup if($('mtd:has(.red.math-sum))').selector === 'mtd:has(.red.math-sum)') {     $('mtd:has(.red.math-sum)').addclass('redunderline');     //addclassml($('mtd:has(.red.math-sum)'),'redunderline'); }  // should work, doesn't add class in ff //$('.red.math-sum').parent().parent().addclass('redunderline');  if($('mtd:has(.red.math-sum-row))') != " ") {     addclassml($('mtd:has(.red.math-sum-row)').parent(),'redunderline'); } if($('mtd:has(.red.math-sum))') != " ") {     addclassml($('mtd:has(.red.math-sum)').parent(),'redunderline'); }   /* not prefered way add class - firefox ignoring addclass jquery function when in math markup */  function addclassml(element,newclassstring){ if(typeof element === 'object' && newclassstring === 'string' && newclassstring.length > 0) {     var i,n=0;     newclass=newclassstring.split(",");     for(i=0;i<newclass.length;i++){         var currentclass = $(element).attr("class");         if(typeof(currentclass) == 'string' && currentclass > 0) {            if(currentclass.indexof(" "+newclass[i]+" ")==-1){                    $(element).attr("class",currentclass+=" "+newclass[i]);                    n++;            }         } else {             $(element).attr("class",newclass[i]);         }     }     return n; } else {     return -1; } }  

i've had trouble using jquery add classes xml elements, such firefox mathml elements, also. see m.addclass in jqmath-0.4.0.js instead inside jqmath - call element.setattribute('class', ...) on xml elements, equivalent addclassml. (or perhaps later version of jquery's .addclass() might someday?)

as say, mathml's elementary math (http://www.w3.org/tr/mathml3/chapter3.html#presm.elementary) not supported in jqmath, or firefox mathml. handles digits , operations, not variables, examples not strictly covered anyway.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -