can't trust htmltext property!

Andre Garzia soapdog at mac.com
Tue Nov 29 12:49:43 EST 2005


Hi Folks,

why on earth Rev is doing this presentation hack. Put a field on a  
stack, set the htmltext of the field to "<h2>SOMETHING</h2>", now,  
pull the html text property and you'll end with something like:

<p></p>
<p></p>
<p><font size="24"><b>SOMETHING</b></font></p>
<p></p>
<p></p>

Now, if, I set a prop to header 2, I want to pull a header 2, not  
something else... I understand that visually it looks the same but  
for anyone working with HTMLText inside a field this is a big no no,  
show stopper. It's picking one carefully selected tag and replacing  
it with dozens of tags, nesting them and doing all kinds of stuff.

Heck, is this documented somewhere? Something like "hey user beware  
the htmltext, it's a lotery, if you set it, you'll never know what  
you'll pull out."

I am doing a html editor, I thought that if I set a field htmltext to  
some html chunk, allowed user to fiddle a little with it, like  
seeting things bold and changing the string, and after fetching the  
htmltext prop would reflect that changes but the root tag would not  
be affected. Now if you're doing a simple editor, just to edit some  
tags and you end up with the nightmare above, you can kiss your CSS  
setup goodbye... Is there a solution or should I simply start rolling  
my own rich editor not trusting the HTMLText property...

HELL the thing is even loosing attributes!!!! if you use something  
like "<p class="footer">my text</p>" when you check the htmltext prop  
you end up with no attributes. I think it's okay for rev to ignore  
the attribute but to loose it.... things should be simpler.

Damn!
Andre



More information about the use-livecode mailing list