[Laszlo-dev] tagnames
P T Withington
ptw at pobox.com
Wed Aug 6 04:01:32 PDT 2008
You know my code better than I do! Ok, let's remove the munging of
the tagName, although we need to make sure that in debug mode you can
distinguish the true button class from one of the anonymous button
subclasses.
On 2008-08-05, at 20:03EDT, André Bargull wrote:
>
> 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