x-tag / core

The Heart of X-Tag
http://x-tag.github.io/
Other
1.25k stars 151 forks source link

How to create custom sub-elements the right way #167

Closed obihill closed 7 years ago

obihill commented 7 years ago

Nice work on this project. Looking to use it soon and I wanted to ask a quick question.

So I know x-tag enables you create custom elements that appear in HTML like this:

<x-my-custom-element>my content</x-my-custom-element>

However, what if I wanted to create multiple custom sub-elements, like this:

<x-my-custom-element>
    <x-my-custom-element-child>
        <x-my-custom-element-grandchild></x-my-custom-element-grandchild>
    </x-my-custom-element-child>
</x-my-custom-element>

Is the right way to simply call register() three times with x-my-custom-element, x-my-custom-element-child, and x-my-custom-element-grandchild?

jpecor-pmi commented 7 years ago

Yes, you'll need to use xtag.register() for any custom elements. Rather than adding a GitHub issue for questions like this, I recommend using the x-tag community chat or ask at StackOverflow.com under the "x-tag" tag.

obihill commented 7 years ago

Thanks. Also, my apologies for using the wrong channel. I've posted the question on StackOverflow for posterity.