One comment, Tucker. I remember that using CSS with underscores in
class names didn't work in some older versions of OpenLaszlo (I think
the 4.0.x series of releases). I had the problem in the RCM project I
did, where ALU recommended that I use _ (underscore) for marking my
custom classes. I've used namespace_class in the past, when there was
not support for CSS.
$ on the other hand gives you problems if you define a CSS style for a
class, e.g.
<canvas width="100%" height="600" debug="true">
<class name="$my$class" extends="view">
</class>
<stylesheet>
$my$class {
width: 100;
}
</stylesheet>
</canvas>
Compiler error:
namespacetest.lzx:6:13: Error parsing css file at line 2, Invalid
identifier start character: $.
W3C on CSS style names: http://www.w3.org/TR/CSS21/syndata.html#characters
"In CSS, identifiers (including element names, classes, and IDs in
selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646
characters U+00A0 and higher, plus the hyphen (-) and the underscore
(_)"
That leaves you with just the _ for marking the namespace, if you want
to apply CSS to your custom tags.
On Sat, Feb 26, 2011 at 10:27 PM, P T Withington <[email protected]> wrote:
> I can't say for sure. For myself, when I need a 'namespace' I just use
> namespaces but replace the `:` or `.` of the namespace with a valid symbol
> character such as `_` or `$`.
>
> E.g.:
>
> $lzc$class
> _dbg_name
>
>
> On 2011-02-26, at 15:35, Laszlo Developer wrote:
>
>> Thanks for the answer, I agree that namespaces are not necessarily a
>> good thing. How does the Webtop team structure the application and
>> make sure you don't pollute the global namespace? Especially, when 3rd
>> party modules are integrated into Webtop?
>>
>> On Sat, Feb 26, 2011 at 7:55 PM, P T Withington <[email protected]> wrote:
>>> There has not been significant pressure to add namespaces to OpenLaszlo,
>>> although there is a Jira task to do so. If you have a need for namespaces,
>>> consider adding your comments to that task.
>>>
>>> Most likely OpenLaszlo will acquire namespaces by default when they are
>>> supported in the majority of ECMAScript platforms OpenLaszlo delivers to.
>>>
>>> Personally, I find most namespace schemes to be overly complex, resulting
>>> in a lot of boilerplate noise and overhead that make even the simplest
>>> program more difficult to comprehend.
>>>
>>> On 2011-02-26, at 11:53, Laszlo Developer wrote:
>>>
>>>> It seems that there is no namespace support in LZX. Is that something
>>>> which will be added in the near future? If not, what are the best
>>>> practices for using namespaces with 4.9 or the upcoming 5.0 release?
>>>>
>>>> Thanks,
>>>> L.
>>>
>>>
>
>
>