/** @jsx createElement *//** @jsxFrag Fragment */import{Fragment,createElement,getReferences}from'jsx-dom';lettree=(<div><h1>Title</h1><p>Text</p></div>);document.body.appendChild(getReferences(tree).self);
features
references
lettree=(<div><h1ref="title">Title</h1></div>);letrefs=getReferences(tree);// replace children with a single text noderefs.title='Updated title';// replace element (reference will be kept)// for now, global references in children are ignoredrefs.title=<h1>Updated title</h1>;// replace children// for now, all references in children are ignoredrefs.title=[<strong>Updated</strong>,' title'];refs.title=<><strong>Updated</strong> title</>;// retreive elementleth1=refs.title.self;
subreferences
lettree=(<ul><liref="item1"><div><!--referstotheclosestparentreference--><divref=".title">Title item 1</div></div></li><liref="item2"><div><divref=".title">Title item 2</div></div></li></ul>
);
let refs = getReferences(tree);
// update subreference
refs.item1.title = 'Updated title item 1';
refs.item2.title = 'Updated title item 2';
// retreive subreference element
let title1 = refs.item1.title.self;