I'll file.
jrs
On May 24, 2007, at 5:13 PM, Jim Grandy wrote:
So perhaps if there's a bug here, its that the @text attribute for
lz.text should have type 'html' rather than 'string'.
jim
On May 24, 2007, at 1:14 PM, P T Withington wrote:
I think we are just sloppy here.
The point is that in XML the stuff that appears between and open
and close tag is officially called 'text'. We've exposed that as
an attribute, because sometimes its useful. (Consider: you might
want to constrain the text of a node.)
Despite it being called text, in our implementation you can use
HTML markup. (In browser DOM, there are properties innerText,
outerText, innerHTML, and outerHTML. Only the latter two
interpret HTML markup.)
On 2007-05-24, at 14:58 EDT, John Sundman wrote:
I'm trying to document something that has been bugging me for
about four years now -- the pseudo-recursive oddness of "text".
The text tag has a @text attribute.
We can have
<canvas height="80">
<simplelayout/>
<text text="foo"/>
<text>bar</text>
</canvas>
This prints out
foo
bar
But if you combine them, you get a compilation warning, naturally
enough:
<canvas height="80">
<simplelayout/>
<text text="foo"/>
<text>bar</text>
<!-- this gives compilation warning. Prints foo -->
<text text="foo">bar</text>
</canvas>
The "text" attribute wins:
foo
bar
foo
This strikes me as a little odd, but not too difficult to get
one's head around. It gets more complicated when you deal with
components.
When you consult the Reference, you find that in the LFC, the
lz.text class has a @text attribute whose type is "string."
The basecomponent class, however, has a @text attribute whose
type is html.
From the text reference page, we get this for documentation for
the text attribute:
text
<attribute name="text" type="string" />
From the basecomponet reference page, we get this for
documentation for the text attribute:
text
<attribute name="text" type="html" value="" />
public var text : lz.html;
the label or title of the component: instead of using this
attribute text may instead be placed withing the tag, for
example: <button>OK</button>
So, the basecomponent "text" attribute is a different kinf of
thing from the "text" attribute of text objects. One is string
and one is html.
OK, we can deal with that. But look at this line
"the label or title of the component: instead of using this
attribute text may instead be placed withing the tag, for
example: <button>OK</button>"
But that's not always true, is it? You cannot do
<window>hello</window>
The title of a window is set by the @title attribute, not
@text. I don't know what @text does in a window. Can anybody
help me out with that?
However, if you want actual text to show up in a window, you have
to do
<window>
<text> hello, I am your happy window text!</text>
</window>
Now, because we have just used a <text> tag, (that is, we have
not touched the "text" object of window, we have created a new
text object that is a child of this window), this should be a
string, right?
Wrong!
As you can see from the text tutorial in the Developer's Guide,
this text acts as if its type is html. How did that happen?
Any enlightenment appreciated.
Thanks,
jrs