Conveniently, that is exactly how jsMath.ProcessBeforeShowing() works you
can pass it a div element in exactly the way that you suggested. This
thought actually occurred to me shortly before you posted it, but I just
got a chance to try it today.

This is my snippet of code...

                JS("""
                    var el = document.getElementById("problem0");
                    jsMath.ProcessBeforeShowing(el);
                """)

And this is what the div element looks like...

<div class="math" style="white-space: normal;" id="problem0">Find
$$\frac{d}{dx}  -6x^{2} + -3x + 1$$</div>

And yet somehow...the document.getElementByID is returning null when I set
a breakpoint there in firebug. I've also tried getElementsByTagName("div")
and that too returned nothing. If you look it in the DOM it shoes that the
ownerDocument is "ProblemPage.html" which is correct. It's parent is the
<td> to which it actually belongs. I don't get it nothing really seems out
of place and yet it can't seem to find it.

If it helps at all this is the code that adds this div...

                problemText = Label(item)
                problemText.setID("problem"+str(index))
                problemText.setStyleName("math")
                self.panel.add(problemText)

where self.panel is just a VerticalPanel and item is the text generated by
a for loop.

Unless I'm doing something simple wrong, this seems to hit at the root of
the problem. I suspect when not passed a element jsMath is doing this exact
same thing more or less.

Any insight/further steps?

Thanks,

Matt

On Mon, Feb 27, 2012 at 12:20 AM, lkcl luke <[email protected]> wrote:

> On Mon, Feb 27, 2012 at 1:11 AM, Matt Kelly <[email protected]> wrote:
> > That makes sense. I was kind of going on this comment
> >
> >
> > "at the moment, like gwt, pyjs always loads in a hidden iframe (for
> obscure
> > compression reasons), so javascript vars won't see each other between
> pyjs
> > and pure javascript."
> >
> > I just don't understand enough about pyjs and iframe's and such to really
> > understand what's going on with why the function isn't working despite
> > seemingly running successfully.
>
>  then you should install venkman and/or firebug and/or other debugging
> tool, insert breakpoints and find out!
>
>  welcome to running in a developer-hostile environment called "web
> browsers" which has nothing to do with pyjamas :)
>
>  it sounds to me like jsMath is trying to be too clever for its own
> good.  it's oversimplified things to the point where it just doesn't
> work.
>
>  try looking to see if there's a function which takes in an HTML
> element.  you should then be able to do this:
>
>  el = getElementsByTagName("name_of_div_by_id_that_you_want_work_done_on");
>  jsMathProcessing(el);
>
> l.
>

Reply via email to