[refined subject, laszlo-reviews -> laszlo-dev] On 2010-05-25, at 18:06, André Bargull wrote:
> On 5/25/2010 11:40 PM, Henry Minsky wrote: >>> >>> Is there documentation on what "text" and "html" types are supposed to >>> mean? (My intuition is that "text" should mean "interpreted as CDATA" and >>> "html" should mean "interpreted as node 'content'". I.e., < and & don't >>> have any special meaning in the former, but they do in the latter. >> >> We had the concept of elements which were allowed to contain HTML tags >> in their text vs ones which weren't, but I don't remember what the >> compiler was supposed to do about enforcing that. Maybe it was >> supposed to warn if you had HTML elements in a content >> that was declared as "text" rather than "html"? > > We've got a (rather simple) table covering valid attributes types at [1]. > > And "text" and "html" types are mentioned here [2]: > > A tag may also contain text if it defines an attribute named text with a > > value Should read "type" (not "value")? > of text (for plain text) or html (for XHTML text), or if it extends a class > that does so. This technique may be used to define a tag that contains text > but does not extend <text> or <inputtext> . > > [1] > http://labs.openlaszlo.org/trunk-nightly/docs/developers/methods-events-attributes.html#d0e76574 > [2] > http://labs.openlaszlo.org/trunk-nightly/docs/developers/introductory-classes.html#introductory-classes.text-classes I propose then that we distinguish the types `text` and `html` from `string`, and that we permit them on any attribute (not just on an attribute named "text": although it is by defining an attribute named text that you tell the schema that your class defines a tag that permits content, you might want other attributes with these types). I propose the following semantics: string: Value is parsed as an ECMAScript string text: Value is parsed as XML CDATA html: Value is parsed as XML content Implementation: string: call the string literal parser on the value, use ScriptCompiler.quote to store the result text: call xmlEscape on the value, use ScriptCompiler.quote to store the result html: use ScriptCompiler.quote to store the value
