How to use the diffhtml.innerHTML function in diffhtml

To help you get started, we’ve selected a few diffhtml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbranyen / diffhtml / packages / diffhtml-website / api-browser.js View on Github external
if (body.classList.contains('open')) {
      return body.onclick();
    }

    body.classList.add('open');

    body.onclick = () => {
      body.classList.remove('open');
      body.onclick = null;
    };
  };
});

const mount = document.querySelector('#api-browser');
console.log(mount);
innerHTML(mount, html`<${ApiBrowser} />`);
github tbranyen / diffhtml / packages / diffhtml-devtools / shared / scripts / panel.js View on Github external
const render = () => innerHTML(document.body, html`
  ${!state.version && html`
    <h1 id="not-found">&lt;/&gt; diffHTML middleware was <span class="not">not</span> found</h1>
  `}

  ${state.version &amp;&amp; html`
    
      

      
github tbranyen / diffhtml / packages / diffhtml-components / lib / web-component.js View on Github external
[$$render]() {
    const oldProps = this.props;
    const oldState = this.state;
    this.props = createProps(this, this.props);
    innerHTML(this.shadowRoot, this.render(this.props, this.state));
    this.componentDidUpdate(oldProps, oldState);
  }
github raen79 / fie / lib / javascript / fie / commander.js View on Github external
processCommand(command, parameters = {}) {
    switch(command) {
      case 'refresh_view':
        innerHTML(document.querySelector('[fie-body=true]'), parameters.html);
        const event = new Event(this.eventName);
        document.dispatchEvent(event);
        break;
      case 'subscribe_to_pools':
        parameters.subjects.forEach(subject => this.cable.subscribeToPool(subject));
        break;
      case 'publish_to_pool': {
        const subject = parameters.subject;
        const object = parameters.object;
        const senderUUID = parameters.sender_uuid;

        this.perform(`pool_${ subject }_callback`, { object: object, sender_uuid: senderUUID });
      } break;
      case 'publish_to_pool_lazy': {
        const subject = parameters.subject;
        const object = parameters.object;
github tbranyen / diffhtml / packages / diffhtml-render-to-string / index.js View on Github external
exports.renderToString = function renderToString(markup, options = {}) {
  const parseHTML = options.strict ? html.strict : html;
  const childNodes = typeof markup === 'string' ? parseHTML(markup) : markup;
  const newTree = createTree('#document-fragment', {}, childNodes);
  const oldTree = createTree(newTree.rawNodeName);

  return innerHTML(oldTree, newTree, { tasks: [...tasks], options });
};