[Laszlo-dev] tagnames
André Bargull
andre.bargull at udo.edu
Tue Aug 5 17:03:02 PDT 2008
On 8/5/2008 10:04 PM, P T Withington wrote:
> I see what you are getting at, but doing so would break this invariant:
>
> lz[this.constructor.tagname] == this.constructor
This is only true in debug-mode!
From NodeModel.java:
> // If there are methods, make a class
> if (debug) {
> String name = id;
> if (name == null) {
> name = CompilerUtils.attributeUniqueName(element, "class");
> }
> // Update tagname to our custom class
> tagName = tagName + "_" + name;
> } else {
> *// Don't create a tag for anonymous classes
> tagName = null;*
> }
And a small testcase:
> <canvas debug="false" >
> <button onclick="txt.setText(this.constructor.tagname)" />
> <text id="txt" x="50" />
> </canvas>
>
> which is presently true for all classes. We would have to say that for
> 'anonymous' classes that does not hold. That's probably ok, but I
> expect that is why it is currently the way it is (at some point in the
> evolution, the anonymous classes were instantiated with a tagname which
> had to be unique; now that they are instantiated directly with their
> classname, we could avoid creating the unique tagnames).
>
> Perhaps there should be some amendment to the debugger also to print
> these anonymous classes in a prettier fashion too.
>
> On 2008-08-05, at 13:43EDT, André Bargull wrote:
>
>> An user asked me on the forum
>> (http://forum.openlaszlo.org/showthread.php?t=12198):
>>
>>> what i want to ask is:
>>> does OL support the original "tagname" in customized instances
>>> (constraint and method filled in tag )?
>>> or
>>> it is a defect?
>>
>> So, whenever an anonymous class was created (because of constraints,
>> handlers etc), do we provide a way to retrieve the original tagname?
>> In my mind, a reasonable question, names like
>> "/button_$$2Etmp_C697C77B63C2714AA45A51E9F3163AFA_hello$2Elzx_2_32/"
>> look ugly and do confuse people (at least me when I see those names in
>> the debugger :-) ).
>>
>>
>> ---
>> And I don't want to get this answer: ;-)
>>> /foo/.constructor.prototype.constructor.tagname
>>
>
>
More information about the Laszlo-dev
mailing list