How to use the @lrnwebcomponents/hax-body/lib/haxutils.js.wipeSlot function in @lrnwebcomponents/hax-body

To help you get started, we’ve selected a few @lrnwebcomponents/hax-body 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 elmsln / lrnwebcomponents / elements / hax-body / hax-body.js View on Github external
importContent(html, clear = true) {
    // kill the slot of the active body, all of it
    if (clear) {
      wipeSlot(this, "*");
    }
    // pause quickly to ensure wipe goes through successfully
    setTimeout(() => {
      html = encapScript(html);
      let fragment = document.createElement("div");
      fragment.insertAdjacentHTML("beforeend", html);
      while (fragment.firstChild !== null) {
        if (typeof fragment.firstChild.tagName !== typeof undefined) {
          // ensure import doesn't import non-sandbox safe things!
          if (
            window.HaxStore.instance._isSandboxed &&
            fragment.firstChild.tagName.toLowerCase() === "iframe"
          ) {
            // Create a replacement tag of the desired type
            var replacement = document.createElement("webview");
            // Grab all of the original's attributes, and pass them to the replacement
github elmsln / lrnwebcomponents / elements / hax-body / hax-body.umd.js View on Github external
importContent(html, clear = true) {
    // kill the slot of the active body, all of it
    if (clear) {
      wipeSlot(this, "*");
    }
    // pause quickly to ensure wipe goes through successfully
    setTimeout(() => {
      html = encapScript(html);
      let fragment = document.createElement("div");
      fragment.insertAdjacentHTML("beforeend", html);
      while (fragment.firstChild !== null) {
        if (typeof fragment.firstChild.tagName !== typeof undefined) {
          // ensure import doesn't import non-sandbox safe things!
          if (
            window.HaxStore.instance._isSandboxed &&
            fragment.firstChild.tagName.toLowerCase() === "iframe"
          ) {
            // Create a replacement tag of the desired type
            var replacement = document.createElement("webview");
            // Grab all of the original's attributes, and pass them to the replacement
github elmsln / lrnwebcomponents / elements / hax-body / hax-body.umd.js View on Github external
haxClearBody(confirm = true) {
    let status = true;
    // only confirm if asked so we can support wipes without it
    if (confirm) {
      status = prompt("Are you sure you want to delete all content?");
    }
    // ensure they said yes
    if (status) {
      wipeSlot(this);
    }
  }
  /**
github elmsln / lrnwebcomponents / elements / hax-body / hax-body.js View on Github external
haxClearBody(confirm = true) {
    let status = true;
    // only confirm if asked so we can support wipes without it
    if (confirm) {
      status = prompt("Are you sure you want to delete all content?");
    }
    // ensure they said yes
    if (status) {
      wipeSlot(this);
    }
  }
  /**
github elmsln / lrnwebcomponents / elements / game-show-quiz / src / game-show-quiz.js View on Github external
_gameDirectionsChanged(newValue) {
    if (newValue) {
      wipeSlot(this);
      let div = document.createElement("div");
      div.style = "padding: 16px;";
      div.innerHTML = newValue;
      this.appendChild(div.cloneNode(true));
    }
  }
  static get properties() {
github elmsln / lrnwebcomponents / elements / game-show-quiz / game-show-quiz.es6.js View on Github external
_gameDirectionsChanged(newValue) {
    if (newValue) {
      wipeSlot(this);
      let div = document.createElement("div");
      div.style = "padding: 16px;";
      div.innerHTML = newValue;
      this.appendChild(div.cloneNode(true));
    }
  }
  static get properties() {

@lrnwebcomponents/hax-body

A full on Headless authoring experience as a single tag. The ultimate authoring solution across platforms to win the future.

Apache-2.0
Latest version published 7 months ago

Package Health Score

72 / 100
Full package analysis