Creates the canvas DOM Element and appends it to the document body
@return {CanvasElement} The newly created canvas element.
10558
function(id) {
		var canvasContainer = document.createElement("div");
		canvasContainer.id = id;
		canvasContainer.width = window.innerWidth;
		canvasContainer.height = window.innerHeight;
		this.addCanvasContainerToDOMBody(canvasContainer);
		this.setDOMMode(canvasContainer, this.domMode);
		return canvasContainer;
	}
577668
function injectScriptElement(targetWindow, doc) {
  var Node = targetWindow.Node;
  var HTMLDocument = targetWindow.HTMLDocument;
  var HTMLScriptElement = targetWindow.HTMLScriptElement;
  var proto = HTMLScriptElement.prototype;

  // Listen for sets on innerText.
  // Listen for sets on src.
  // Track when added to DOM via appendChild.

  // Replace appendChild/etc so that we can watch for script adds.
  var originalAppendChild = Node.prototype.appendChild;
  Node.prototype.appendChild = function appendChild(newChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // appendChild(<script>)
      log('appendChild of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalAppendChild.call(this, processedChild);
    } else {
      return originalAppendChild.apply(this, arguments);
    }
  };
  var originalInsertBefore = Node.prototype.insertBefore;
  Node.prototype.insertBefore = function insertBefore(newChild, refChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // insertBefore(<script>, ...)
      log('insertBefore of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalInsertBefore.call(this, processedChild, refChild);
    } else {
      return originalInsertBefore.apply(this, arguments);
    }
  };
  var originalReplaceChild = Node.prototype.replaceChild;
  Node.prototype.replaceChild = function replaceChild(
      newChild, oldChild) {
    if (newChild instanceof HTMLScriptElement && !newChild['__wtfi__']) {
      // replaceChild(<script>, ...)
      log('insertBefore of script', newChild);
      var baseUrl = arguments.callee.caller ?
          arguments.callee.caller['__src'] : null;
      var processedChild = processScript(newChild, false, baseUrl);
      return originalReplaceChild.call(this, processedChild, oldChild);
    } else {
      return originalReplaceChild.apply(this, arguments);
    }
  };

  // Replace document.createElement so we can hook new script elements.
  // var originalCreateElement = HTMLDocument.prototype.createElement;
  // HTMLDocument.prototype.createElement = function createElement(tagName) {
  //   if (tagName.toLowerCase() == 'script') {
  //     // <script>.
  //     var result = originalCreateElement.apply(this, arguments);
  //     log('could instrument <script>', result);
  //     return result;
  //   } else {
  //     return originalCreateElement.apply(this, arguments);
  //   }
  // };
}
513726
function Element(domElement) {

      // Helpers
      this.attr = function(attrName) {
        return domElement.getAttributeNS(null, attrName);
      };

      // Properties
      this.tag = domElement.tagName;
      this.class = this.attr('class');
      this.id = this.attr('id');

      // Methods
      this.isNode = function() {
        return !!~this.class.indexOf(self.settings('classPrefix') + '-node');
      };

      this.isEdge = function() {
        return !!~this.class.indexOf(self.settings('classPrefix') + '-edge');
      };

      this.isHover = function() {
        return !!~this.class.indexOf(self.settings('classPrefix') + '-hover');
      };
    }
905234
function CanvasControl(canvas, elements, callbackFunc) {
  this._canvas = canvas;
  this._elements = elements;
  this._callbackFunc = callbackFunc;

  this._context = this._canvas.getContext('2d');
  this._cursorDown = false;

  this._selected = {
    index: -1,
    xOffset: 0,
    yOffset: 0,
  };

  this._lastMoveEventTime = 0;
  this._minimumThreshold = 16;
  let that = this;
  canvas.addEventListener('touchstart', function(event) {
    that._cursorDownFunc(event);
  });

  canvas.addEventListener('mousedown', function(event) {
    that._cursorDownFunc(event);
  });

  canvas.addEventListener('touchmove', function(event) {
    let currentEventTime = Date.now();
    if (currentEventTime - that._lastMoveEventTime > that._minimumThreshold) {
      that._lastMoveEventTime = currentEventTime;
      if (that._cursorMoveFunc(event)) {
        event.preventDefault();
      }
    }
  }, true);

  canvas.addEventListener('mousemove', function(event) {
    let currentEventTime = Date.now();
    if (currentEventTime - that._lastMoveEventTime > that._minimumThreshold) {
      that._lastMoveEventTime = currentEventTime;
      that._cursorMoveFunc(event);
    }
  });

  document.addEventListener('touchend', function(event) {
    that._cursorUpFunc(event);
  });

  document.addEventListener('mouseup', function(event) {
    that._cursorUpFunc(event);
  });

  window.addEventListener('resize', function(event) {
    that.resize();
    that.draw();
  }, false);

  this.invokeCallback();
  this.resize();
  this.draw();
}
579756
function injectSvg(){
      // set base before <style> element creating, because IE9+ set baseURI
      // for <style> element on element creation
      setBase(this.baseURI);

      // create <style> element for first time
      if (!this.element)
      {
        this.element = document.createElement('span');

        /** @cut */ this.element.setAttribute('src', this.url);
      }

      // add element to document
      svgStorageElement.appendChild(this.element);

      this.syncSvgText();

      restoreBase();
    }
359247
public static Document createDOMDocument()
    {
        try {
            return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException ex) {
            LOGGER.error("Cannot create DOM Documents", ex);
            return null;
        }
    }
304972
function() {
        if (this._element) {
          // Firefox versions < 11 do not have support for element.outerHTML.
          var thisElement = this.element();
          var outerHTML = thisElement.outerHTML;
          if (typeof outerHTML === 'undefined') {
            return jQuery('<div/>').append(thisElement).html();
          }
          return outerHTML;
        } else {
          return this.innerString();
        }
      }
1245354
function createFrame (bodyContent, callbackId, callback) {
    var Proto = function Frame () {},
        api = new Proto(),
        domElement = scope.document.createElement('iframe');

    domElement.id = 'OTPlugin_frame_' + $.uuid().replace(/\-+/g, '');
    domElement.style.border = '0';

    try {
      domElement.style.backgroundColor = 'rgba(0,0,0,0)';
    } catch (err) {
      // Old IE browsers don't support rgba
      domElement.style.backgroundColor = 'transparent';
      domElement.setAttribute('allowTransparency', 'true');
    }

    domElement.scrolling = 'no';
    domElement.setAttribute('scrolling', 'no');

    // This is necessary for IE, as it will not inherit it's doctype from
    // the parent frame.
    var frameContent = '<!DOCTYPE html><html><head>' +
                      '<meta http-equiv="x-ua-compatible" content="IE=Edge">' +
                      '<meta http-equiv="Content-type" content="text/html; charset=utf-8">' +
                      '<title></title></head><body>' +
                      bodyContent +
                      '<script>window.parent["' + callbackId + '"](' +
                        'document.querySelector("object")' +
                      ');</script></body></html>';

    var wrappedCallback = function() {
      OTPlugin.log('LOADED IFRAME');
      var doc = domElement.contentDocument || domElement.contentWindow.document;

      if ($.env.iframeNeedsLoad) {
        doc.body.style.backgroundColor = 'transparent';
        doc.body.style.border = 'none';

        if ($.env.name !== 'IE') {
          // Skip this for IE as we use the bookmarklet workaround
          // for THAT browser.
          doc.open();
          doc.write(frameContent);
          doc.close();
        }
      }

      if (callback) {
        callback(
          api,
          domElement.contentWindow,
          doc
        );
      }
    };

    scope.document.body.appendChild(domElement);

    if($.env.iframeNeedsLoad) {
      if ($.env.name === 'IE') {
        // This works around some issues with IE and document.write.
        // Basically this works by slightly abusing the bookmarklet/scriptlet
        // functionality that all browsers support.
        domElement.contentWindow.contents = frameContent;
        /*jshint scripturl:true*/
        domElement.src = 'javascript:window["contents"]';
        /*jshint scripturl:false*/
      }

      $.on(domElement, 'load', wrappedCallback);
    } else {
      setTimeout(wrappedCallback, 0);
    }

    api.reparent = function reparent (target) {
      // document.adoptNode(domElement);
      target.appendChild(domElement);
    };

    api.element = domElement;

    return api;
  }
160394
protected DOMOutputElement createAndAttachChild(Element element)
    {
        if (mRootNode != null) {
            mRootNode.appendChild(element);
        } else {
            mElement.appendChild(element);
        }
        return createChild(element);
    }
470750
function() {
		
	   // A hidden input field to store the color code 
	   this.el = inputEx.cn('input', {
	      type: 'hidden', 
	      name: this.options.name || '', 
	      value: this.options.value || '#FFFFFF'
	   });
	   	   
      // This element wraps the input node in a float: none div
      this.wrapEl = inputEx.cn('div', {className: 'inputEx-ColorPickerField-wrapper'});
	   this.wrapEl.appendChild(this.el);

		// Create a Menu instance to house the ColorPicker instance
		this.menuElId = Dom.generateId();
		var oColorPickerMenu = new YAHOO.widget.Menu(this.menuElId);
		this.oColorPickerMenu = oColorPickerMenu;

		// Create a Button instance of type "menu"
		this.labelElId = Dom.generateId();
		var oButton = new YAHOO.widget.Button({ 
			type: "menu", 
			className: "inputEx-ColorPicker-Button",
			label: "<em id=\""+this.labelElId+"\" class='inputEx-ColorPicker-Label'>Current color is #FFFFFF.</em>", 
			menu: oColorPickerMenu, 
			container: this.wrapEl
		});
		
		var that = this;
		oButton.on("appendTo", function () {
			oColorPickerMenu.setBody(" ");
			oColorPickerMenu.body.id = Dom.generateId();
			Dom.addClass(oColorPickerMenu.body, that.options.colorPickerOptions.showcontrols ? "inputEx-ColorPicker-Container" : "inputEx-ColorPicker-Container-nocontrols");
			oColorPickerMenu.render(this.get('container'));
		});

		/*
			Add a listener for the "click" event.  This listener will be
			used to defer the creation the ColorPicker instance until the 
			first time the Button's Menu instance is requested to be displayed
			by the user.
		*/
		oButton.on("click", this.onButtonClickOnce, this, true);
		
		this.oButton = oButton;

		this.fieldContainer.appendChild(this.wrapEl);
	}
243057
function createTextElement (name, element = {}) {
  let classToAdd = ''
  const Tag = name

  if (/^h\d$/i.test(name)) {
    classToAdd = 'header'
  } else {
    classToAdd = 'text'
  }

  return createElement(name, merge({
    attrs: true,
    rules: {
      [`.${name}.${classToAdd}`]: [ { '@pseudo': 'root' }, '@default', { display: transforms.trueHide() }, margin, background, border, borderRadius, text, font ]
    },
    render (attrs, contents) {
      attrs.class += ` ${classToAdd} ${name}`

      return <Tag {...attrs}>{contents}</Tag>
    }
  }, element))
}
802688
function() {
      var canvasEl = fabric.document.createElement('canvas');

      if (!canvasEl.getContext && typeof G_vmlCanvasManager != 'undefined') {
        G_vmlCanvasManager.initElement(canvasEl);
      }

      this._render(canvasEl.getContext('2d'));
    }
668927
function () {
    function impl (element) {
      customElement.call(this, element)
    }
    impl.prototype = Object.create(customElement.prototype)
    return impl
  }
1344000
function createDocument(args) {
  const { browser } = args;

  const features = {
    FetchExternalResources:   [],
    ProcessExternalResources: [],
    MutationEvents:           '2.0'
  };

  const window  = new Window({
    parsingMode:  'html',
    contentType:  'text/html',
    url:          args.url,
    referrer:     args.referrer
  });

  const { document } = window;
  const documentImpl = idlUtils.implForWrapper(document)

  if (args.browser.hasFeature('scripts', true)) {
    features.FetchExternalResources.push('script');
    features.ProcessExternalResources.push('script');
    window._runScripts = 'dangerously';
  }
  if (args.browser.hasFeature('css', false)) {
    features.FetchExternalResources.push('css');
    features.FetchExternalResources.push('link');
  }
  if (args.browser.hasFeature('img', false))
    features.FetchExternalResources.push('img');
  if (args.browser.hasFeature('iframe', true))
    features.FetchExternalResources.push('iframe');


  browserFeatures.applyDocumentFeatures(documentImpl, features);
  setupWindow(window, args);

  // Give event handler chance to register listeners.
  args.browser.emit('loading', document);
  return document;
}
1084830
public Element makeStyleElement(Document document) {
    Element style = SVGUtil.makeStyleElement(document);
    updateStyleElement(document, style);
    return style;
  }
531751
function (dom) {
            var html = '';
            dom.forEach(function (node) {
                if (node.type === 'tag') {
                    var tag = node.name;
                    html += '<' + tag;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += (voidTags[tag] ? '/>' : '>');
                    if (!voidTags[tag]) {
                        html += this.vdomToHtml(node.children);
                        html += '</' + tag + '>';
                    }
                } else if (node.type === 'text') {
                    var text = node.data || '';
                    html += this.htmlEncode(text); //escape <,> and &.
                } else if (node.type === 'comment') {
                    html += '<!-- ' + node.data.trim() + ' -->';
                } else if (node.type === 'script' || node.type === 'style') {
                    //No need to escape text inside script or style tag.
                    html += '<' + node.name;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += '>' + ((node.children[0] || {}).data || '') + '</' + node.name + '>';
                } else if (node.type === 'directive') {
                    html += '<' + node.data + '>';
                }
            }, this);
            return html;
        }
1370605
function(value) {
		var wrapper = createElement('div');
		wrapper.innerHTML = ''+value;

		// trim extraneous whitespace
		trimWhitespace(wrapper);

		// eliminate wrapper for single nodes
		if (wrapper.childNodes.length === 1) {
			return wrapper.firstChild;
		}

		// create a document fragment to hold elements
		var frag = createElement('');
		while (wrapper.firstChild) {
			frag.appendChild(wrapper.firstChild);
		}
		return frag;
	}