dna

Evolution-based components.

With the incremental DOM implementation of DNA, passing a HTML string as content of a node will just create a text node, instead of rendering the HTML. For security reasons, this is the default behaviour of the render method of a component.

Since 2.9.0 version, DNA can inject HTML source inside a node marking the content as trusted through the trust helper:

import { BaseComponent, define, trust } from '@dnajs/idom';

class VenueCard extends BaseComponent {
  get properties() {
    return {
      title: String,
      description: String
    };
  }

  get template() {
    return <div class="wrapper">
      <h1>{this.title}</h1>
      <div class="description">{trust(this.description)}</div>
    </div>;
  }
}

define('venue-card', VenueCard);