Jacque,

I don't agree and the solution is simple: just include a statement in the docs that the htmlText property is never empty but always returns at least one pair of p tags.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com

Buy my new book "Programming LiveCode for the Real Beginner" http://qery.us/3fi

LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 3/19/2014 16:45, J. Landman Gay wrote:
On 3/19/14, 9:35 AM, Mark Schonewille wrote:
In the past 15 years I never had any problems with htmlText always
containing p tags, even if the text of the field was empty.
Therefore, I think it is no bug.

I haven't had any problem with it either, but that doesn't mean it isn't
a bug. Consider this, which is very similar to what my current project
does:

A user enters some styled text into a field. The text is stored as
htmltext in a custom property.

Because the field is a background field, there may be many of these
properties per field, and the correct text is displayed based on the
stack's current status. In my project, a preOpenCard handler looks for
the correct property to determine which text to display.

In some cases the script needs to determine whether the custom property
has content or not in order to take action. Because the text in the
field may not be the text that needs to be checked, the custom property
is checked.

If it contains paragraph tags, it isn't empty and the script fails. (In
my case this doesn't matter; in other cases it could.)

I anticipate you will say "don't put anything in the custom property if
you plan to check it" -- but if the content is set by the user then we
have no control over that. And I agree -- if there is no content, then
the engine should not put anything into the custom property.

It isn't difficult to script around the behavior but I think it
shouldn't happen in the first place. And it does defy the definition of
"empty."


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to