Problem with setting htmlText of field to empty in LiveCode 6.6 RC2

Devin Asay devin_asay at byu.edu
Wed Mar 19 13:38:44 EDT 2014


On Mar 19, 2014, at 9:57 AM, "J. Landman Gay" <jacque at hyperactivesw.com>
 wrote:

> On 3/19/14, 10:25 AM, Bob Sneidar wrote:
>> I am struggling to see when this would present an impassible problem.
> 
> I grant that it's trivial and not a high priority. But it makes the language inconsistent, and I see that as the primary issue.
> 
> I gave an example in another post of how it could affect scripts. Try this in a newly created field with no content:
> 
>  set the cText of this cd to the htmltext of fld 1
>  put (the cText of this cd = empty)
> 
> Empty is no longer empty. Sometimes it will matter.

HtmlText is an odd beast. I think Robert may be on the right track when he wonders about it being an add-on. Try this:

Paste the following html list markup in field "source":

<ol>
<li>List item 1</li>
<li>List item 2</li>
</ol>

Now use it as the source to set the htmlText of another field "dest":

  set the htmlText of fld "dest" to fld "source"

Now examine the htmlText of fld "dest". You get this:

<ol type="1">
<li>
<p>List item 1</p>
</li>
<li>
<p>List item 2</p>
</li>
</ol>

Now manually select the text in fld "dest" and hit delete. The contents of fld "dest" looks like this:

1.

No matter what you do you can't manually delete the first list item marker. The htmlText of "dest" now looks like this:

<ol type="1">
<li>
<p></p>
</li>
</ol>

The field thinks it's a list and you can't change it's mind. Unless you do this:

  put empty into fld "dest"

At which point the htmlText is <p></p>. Which is where this all started. :)

We had an interesting discussion of the html list issue in the Quality Control center a couple of years ago: http://quality.runrev.com/show_bug.cgi?id=9342

Best,

Devin Asay
Learn to code with LiveCode University
http://university.livecode.com







More information about the use-livecode mailing list