All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.js.vendor.modernizr.src.getBody.js Maven / Gradle / Ivy

The newest version!
define(['createElement', 'isSVG'], function(createElement, isSVG) {
  /**
   * getBody returns the body of a document, or an element that can stand in for
   * the body if a real body does not exist
   *
   * @access private
   * @function getBody
   * @returns {HTMLElement|SVGElement} Returns the real body of a document, or an
   * artificially created element that stands in for the body
   */

  function getBody() {
    // After page load injecting a fake body doesn't work so check if body exists
    var body = document.body;

    if (!body) {
      // Can't use the real body create a fake one.
      body = createElement(isSVG ? 'svg' : 'body');
      body.fake = true;
    }

    return body;
  }

  return getBody;
});




© 2015 - 2025 Weber Informatics LLC | Privacy Policy