Custom HTML elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom HTML elements

Andy Burnett
Although the browser support is patchy, custom elements would seem to fit with the seaside/amber environment really well.  I could imagine building a component in Amber that renders itself as a custom html element. The programming flow would be so natural.

Is anyone else experimenting with them?

Cheers
Andy

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Custom HTML elements

Herby Vojčík
There are snippets, which are like custom elements inside amber (you use 'html myCustomTag') but are in fact preconfigured pieces of DOM that are cloned.

You should put (div and span just for example, you can build it from anything):

<div data-snippet="mycustomtag">....<span data-snippet="*"></span>...<div>

somewhere in HTML; when amber starts it detaches it from the page and whenever you issue

html mycustomtag

in amber, it clones it and returns the tag with "*" (span in previous example).

Herby

Andy Burnett wrote:

> Although the browser support is patchy, custom elements would seem to
> fit with the seaside/amber environment really well.  I could imagine
> building a component in Amber that renders itself as a custom html
> element. The programming flow would be so natural.
>
> Is anyone else experimenting with them?
>
> Cheers
> Andy
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from thi
s group and stop receiving emails from it, send
> an email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Custom HTML elements

Andy Burnett
Hmm that's very interesting.

I was thinking about this the wrong way.  My - very simple - thought had been to include the Mozilla Brick library, and then to define tag brushes for e.g. Slider.  Would that approach work at all?

Cheers
Andy


On Thu, Aug 29, 2013 at 2:49 AM, Herby Vojčík <[hidden email]> wrote:
There are snippets, which are like custom elements inside amber (you use 'html myCustomTag') but are in fact preconfigured pieces of DOM that are cloned.

You should put (div and span just for example, you can build it from anything):

<div data-snippet="mycustomtag">....<span data-snippet="*"></span>...<div>

somewhere in HTML; when amber starts it detaches it from the page and whenever you issue

html mycustomtag

in amber, it clones it and returns the tag with "*" (span in previous example).

Herby

Andy Burnett wrote:
Although the browser support is patchy, custom elements would seem to fit with the seaside/amber environment really well.  I could imagine building a component in Amber that renders itself as a custom html element. The programming flow would be so natural.

Is anyone else experimenting with them?

Cheers
Andy

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from thi
s group and stop receiving emails from it, send
an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Custom HTML elements

Herby Vojčík
Andy Burnett wrote:
> Hmm that's very interesting.
>
> I was thinking about this the wrong way.  My - very simple - thought
> had been to include the Mozilla Brick library, and then to define tag
> brushes for e.g. Slider.  Would that approach work at all?

I don't know Mozilla Brick library, but in general, TagBrush is not built to repesent anything complex, the way how its workings are implemented (with:, attr: etc.) is tied to the fact it repesent single tag.

Snippets themselves are bit of a lie: you issue 'html customtag', but the returned TagBrush is the one representing inner one (the caret) with the 'data-snippet="*"', even if the whole wrapping HTML put there. But it works fine for many cases. Snippets more or less lets you do methods like 'renderSkeletonOfStructureOn: html html div with: [ html p with: [ ^html snap ]]' (along with class:, attr: etc. in between) in descriptive HTML instead of in code.

> Cheers
> Andy

Herby

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.