NB this message contains html that is not intended to be formatted!
Some background: About a month ago, I started learning ruby on rails,
thru which I learnt about MVC frameworks, etc. Figuring I should
explore my options, and following a little inner voice that said
"Wouldn't you like to do this in perl?" I'm now learning Mason (but
not, at this point, catalyst). All is good and I am happy EXCEPT:
For my first exercise, I figured I would take a simple RonR app I did
and rewrite it using Mason. I've hit what seems to me a strange glitch
involving CSS. First, the *minor* symptoms: I have a div which is a
horizontal menu bar, the original code looked like this:
<center><h3 class="menu">
<span onclick="[some ruby js helper]">
Main Menu</span> |
<span onclick="[another ruby js helper]>
Search List</span></h3>
</center></div>
So the menu bar = " Main Menu | Search List ". Class "menu" here has a
":hover" defined to highlight, and using the code above, span sufficed
as a separator. When I moved this into the mason version, however,
hovering over *either* span highlit both of them (as did adding the css
class to the individual span), so I had to change this to:
<div class="menubar" id="mmdiv">
<h3><span id="mmspan" onmouseover="$('mmspan').style.color='#ff0066'"
onmouseout="$('mmspan').style.color='#ffffff'" onclick="mainmenu(<&
mmenu1.comp &>)">Main Menu</span>
| <span id="slspan" onmouseover="$('slspan').style.color='#ff0066'"
onmouseout="$('slspan').style.color='#ffffff'" onclick="mainmenu
([unfinished])">Search List</span>
</h3></div>
Which is irritating and mysterious, but I can live with it.
Another potential symptom is that .class:hover attributes were ignored
unless they were part of a tag type:
.mini { font-size: small; color: #bbbbbb; margin: 10px 10px 10px
10px; }
p.mini:hover { color: #ffff00; }
If I use ".mini:hover" instead of "p.mini:hover", this style is
ignored. Meaning I will have to repeat this for every tag type!
But the *MAJOR* symptom seems to be this: mmenu1.comp (from above)
looks like this
<p>Add Subject</p>
mainmenu() calls a dropdown menu, and the parameter is the innerHTML
for that menu. As is, this works fine. However, if I change
mmenu1.comp slightly:
<p class="whatever">Add Subject</p>
A *very* *very* strange thing happens: the contents of mmenu1.comp
replace the div containing the menu bar (a *different* div) *before*
any "onclick" has occurred, so on load the menubar looks like this:
Add Subject
instead of "Main Menu | Search List"
I am so flabbergasted by this I have at least half a dozen times
reloaded the page making *only* the above change to mmenu1.comp, and
this difference is the same everytime. *How is it even possible* that
the contents of a parameter to a js function in an onclick
<span id="mmspan" onclick="mainmenu(<& mmenu1.comp &>)">Main Menu</
span>
would replace the entire div containing the span when the page is
loaded, just because I added
class="somestyle"
to mmenu1.comp????????????
Thanks in advance, MK
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users