You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Hugo Ferreira <hf...@gmail.com> on 2022/02/24 23:30:53 UTC

id with dash (-)

Hi,

Why does an element with dash on id (ex: id="sidebar-menu") raise an error
while compiling ?

Re: id with dash (-)

Posted by Hugo Ferreira <hf...@gmail.com>.
Hi,

Yes, I avoid it at all depending on the id.
In this particular case, I'm using a css that depends on the id on several
css parts.

Perhaps, I will copy the original css and remove this dependency on the id
or change the id.


Greg Dove <gr...@gmail.com> escreveu no dia sexta, 25/02/2022 à(s)
00:03:

> It's helpful to think of 'id' as a public getter/setter definition (which
> is essentially the same as a [Bindable] public var definition) on the class
> represented by the containing mxml document. So it has to follow
> actionscript rules for naming a getter/setter (or variable).
> You cannot write code like this in actionscript:
>
> [Bindable]
> publio var sidebar-menu:SideBarMenu;
>
> because '-' is not permitted in a variable name, so the compiler will let
> you know about that  (however '_' is permitted).
>
> The DOM version of 'id' is coincidental here, and has different (more
> lenient) rules.
>
> For most Royale apps I don't see the need to propagate the id to the DOM.
> Usually I would use className to do some custom styling.
>
>
>
>
> On Fri, Feb 25, 2022 at 12:30 PM Hugo Ferreira <hf...@gmail.com>
> wrote:
>
> > Hi,
> >
> > Why does an element with dash on id (ex: id="sidebar-menu") raise an
> error
> > while compiling ?
> >
>

Re: id with dash (-)

Posted by Greg Dove <gr...@gmail.com>.
It's helpful to think of 'id' as a public getter/setter definition (which
is essentially the same as a [Bindable] public var definition) on the class
represented by the containing mxml document. So it has to follow
actionscript rules for naming a getter/setter (or variable).
You cannot write code like this in actionscript:

[Bindable]
publio var sidebar-menu:SideBarMenu;

because '-' is not permitted in a variable name, so the compiler will let
you know about that  (however '_' is permitted).

The DOM version of 'id' is coincidental here, and has different (more
lenient) rules.

For most Royale apps I don't see the need to propagate the id to the DOM.
Usually I would use className to do some custom styling.




On Fri, Feb 25, 2022 at 12:30 PM Hugo Ferreira <hf...@gmail.com>
wrote:

> Hi,
>
> Why does an element with dash on id (ex: id="sidebar-menu") raise an error
> while compiling ?
>