mozilla - Creating custom _nested_ html tags using x-tag -
i'm attempting create custom html tag using mozilla's http://www.x-tags.org/. have been able register test tag , utilize correctly; however, can't find examples of nested tags.
for example: <parent-tag parent-attribute="parent"> <child-tag child-attribute="child1"/> <child-tag>child2</child-tag> </parent-tag>
can parent-attribute using 'accessors,' how child-attribute or value of sec child-tag?
i've seen couple of hints within lifecycle of kid nodes, should reference parent nodes. however, how work when set of tag hierarchy works create result:
<chart-tag width="300", height="300"> <chart-x-axis isvisible="false"/> <chart-y-axis min="0" max="100"/> <chart-legend> legend</chart-legend> </chart-tag>
in order convert made-up tag soup chart, need values nodes. have start traversing parent/sibling nodes myself?
i've been able solve this, although i'm not if best way.
in parent tag, time 'inserted' lifecycle called, kid nodes have been parsed , can accessed by
xtag.querychildren(this,'child-node-tag');
reference kid nodes can used traverse attributes: childnode.attribute1
note kid tags must registered, although there doesn't seem need 'link' parent , kid tags in direct way. simple illustration available @ https://github.com/falconair/dimple-chart/blob/master/dimple-chart-test.htm (take @ code in version history, don't know how evolve on time).
html mozilla web-component x-tag
No comments:
Post a Comment