How to use the ssr-window.document.createElement function in ssr-window

To help you get started, we’ve selected a few ssr-window 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 framework7io / framework7 / packages / core / modules / router / router-class.js View on Github external
$navbarsEl: view.$navbarsEl,
        navbarsEl: view.navbarsEl,
        history: view.history,
        scrollHistory: view.scrollHistory,
        cache: app.cache,
        dynamicNavbar: app.theme === 'ios' && view.params.iosDynamicNavbar,
        initialPages: [],
        initialNavbars: [],
      });
    }

    // Install Modules
    router.useModules();

    // Temporary Dom
    router.tempDom = document.createElement('div');

    // AllowPageChage
    router.allowPageChange = true;

    // Current Route
    let currentRoute = {};
    let previousRoute = {};
    Object.defineProperty(router, 'currentRoute', {
      enumerable: true,
      configurable: true,
      set(newRoute = {}) {
        previousRoute = Utils.extend({}, currentRoute);
        currentRoute = newRoute;
        if (!currentRoute) return;
        router.url = currentRoute.url;
        router.emit('routeChange', newRoute, previousRoute, router);
github framework7io / framework7 / dist / utils / component.js View on Github external
}
        return line;
      }).join('\n');
    }

    let scriptContent;
    if (componentString.indexOf('')[0].trim();
    } else {
      scriptContent = 'return {}';
    }
    scriptContent = `window.${callbackName} = function () {${scriptContent}}`;

    // Insert Script El
    const scriptEl = document.createElement('script');
    scriptEl.innerHTML = scriptContent;
    $('head').append(scriptEl);

    const component = window[callbackName]();

    // Remove Script El
    $(scriptEl).remove();

    if (!component.template && !component.render) {
      component.template = template;
    }
    if (style) {
      component.style = style;
      component.styleScopeId = styleScopeId;
    }
    return component;
github framework7io / framework7 / src / core / modules / component / parse-component.js View on Github external
// Parse Script
  let scriptContent;
  let scriptEl;
  if (componentString.indexOf('')[0].trim();
  } else {
    scriptContent = 'return {}';
  }
  if (!scriptContent || !scriptContent.trim()) scriptContent = 'return {}';

  scriptContent = `window.${callbackCreateName} = function () {${scriptContent}}`;

  // Insert Script El
  scriptEl = document.createElement('script');
  scriptEl.innerHTML = scriptContent;
  $('head').append(scriptEl);

  const component = window[callbackCreateName]();
  const isClassComponent = typeof component === 'function';

  // Remove Script El
  $(scriptEl).remove();
  window[callbackCreateName] = null;
  delete window[callbackCreateName];

  // Assign Template
  if (!component.template && !component.render) {
    component.template = template;
    component.templateType = templateType;
  }
github nolimits4web / dom7 / dist / dom7.module.js View on Github external
}
  }
  if (selector) {
      // String
    if (typeof selector === 'string') {
      let els;
      let tempParent;
      const html = selector.trim();
      if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
        let toCreate = 'div';
        if (html.indexOf(':~]/)) {
          // Pure ID selector
          els = [document.getElementById(selector.trim().split('#')[1])];
        } else {
          // Other selectors
          els = (context || document).querySelectorAll(selector.trim());
        }
        for (i = 0; i < els.length; i += 1) {
          if (els[i]) arr.push(els[i]);
        }
      }
github framework7io / framework7 / src / core / modules / component / vdom.js View on Github external
export default function (html = '', context, initial) {
  // Save to temp dom
  const htmlTrim = html.trim();
  let tempDom = tempDomDIV;
  if (htmlTrim.indexOf('
github capricorncd / image-process-tools / src / js / handler / video.js View on Github external
function getVideoCapture ($video, start = 0) {
  // 暂停视频
  $video.pause()
  // 生成图片类型
  let dataType = 'image/jpeg'
  // 创建canvas
  let $canvas = document.createElement('canvas')
  let ctx = $canvas.getContext('2d')

  $canvas.width = $video.videoWidth
  $canvas.height = $video.videoHeight

  // ctx.drawImage(video, res.sx, res.sy, res.sw, res.sh, 0, 0, res.cw, res.ch)
  ctx.drawImage($video, 0, 0, $canvas.width, $canvas.height)

  // 图片数据
  let base64 = null
  let err = null
  // 视频文件和当前操作界面不在同一域,则会报错
  try {
    base64 = $canvas.toDataURL(dataType)
  } catch (e) {
    err = {
github nolimits4web / swiper / src / components / mousewheel / mousewheel.js View on Github external
function isEventSupported() {
  const eventName = 'onwheel';
  let isSupported = eventName in document;

  if (!isSupported) {
    const element = document.createElement('div');
    element.setAttribute(eventName, 'return;');
    isSupported = typeof element[eventName] === 'function';
  }

  if (!isSupported
    && document.implementation
    && document.implementation.hasFeature
    // always returns true in newer browsers as per the standard.
    // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
    && document.implementation.hasFeature('', '') !== true
  ) {
    // This is the only way to test support for the `wheel` event in IE9+.
    isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  }

  return isSupported;
github framework7io / framework7 / src / core / components / virtual-list / virtual-list-class.js View on Github external
vl.$ul = vl.$el.children('ul');
    }
    vl.ul = vl.$ul[0];

    let $itemsWrapEl;
    if (!vl.ul && !vl.params.createUl) $itemsWrapEl = vl.$el;
    else $itemsWrapEl = vl.$ul;

    Utils.extend(vl, {
      $itemsWrapEl,
      itemsWrapEl: $itemsWrapEl[0],
      // DOM cached items
      domCache: {},
      displayDomCache: {},
      // Temporary DOM Element
      tempDomElement: document.createElement('ul'),
      // Last repain position
      lastRepaintY: null,
      // Fragment
      fragment: document.createDocumentFragment(),
      // Props
      pageHeight: undefined,
      rowsPerScreen: undefined,
      rowsBefore: undefined,
      rowsAfter: undefined,
      rowsToRender: undefined,
      maxBufferHeight: 0,
      listHeight: undefined,
      dynamicHeight: typeof vl.params.height === 'function',
    });

    // Install Modules
github capricorncd / image-process-tools / src / js / handler / image.js View on Github external
function craeteImage (url) {
  const $image = document.createElement('img')
  $image.src = url
  return $image
}
github capricorncd / zx-editor / src / js / image.js View on Github external
function createCanvas ($el, p) {
  const canvas = document.createElement('canvas')
  canvas.width = p.cw
  canvas.height = p.ch
  const ctx = canvas.getContext('2d');
  ctx.drawImage($el, p.sx, p.sy, p.sw, p.sh, 0, 0, canvas.width, canvas.height);
  return canvas
}