jQuery clone() does not copy textarea contents, so we explicitly do it here.
181752
function setTextareaContent(dom) {
  dom.find('textarea').each(function() {
    let elem = percyJQuery(this);
    elem.text(elem.val());
  });

  return dom;
}
558856
function clone(target) {
  if (target == null || typeof target !== "object") return target;
  var cloned = target.constructor ? target.constructor() : Object.create(null);
  for (var attr in target) {
    if (target.hasOwnProperty(attr)) {
      cloned[attr] = target[attr];
    }
  }
  return cloned;
}
293946
function (node) {
    var parentTag = node.parentNode && jsxTagName(node.parentNode.tagName);
    if (parentTag === 'textarea' || parentTag === 'style') {
      // Ignore text content of textareas and styles, as it will have already been moved
      // to a "defaultValue" attribute and "dangerouslySetInnerHTML" attribute respectively.
      return;
    }

    var text = escapeSpecialChars(node.textContent);

    if (this._inPreTag) {
      // If this text is contained within a <pre>, we need to ensure the JSX
      // whitespace coalescing rules don't eat the whitespace. This means
      // wrapping newlines and sequences of two or more spaces in variables.
      text = text
        .replace(/\r/g, '')
        .replace(/( {2,}|\n|\t|\{|\})/g, function (whitespace) {
          return '{' + JSON.stringify(whitespace) + '}';
        });
    } else {
      // Handle any curly braces.
      text = text
        .replace(/(\{|\})/g, function (brace) {
          return '{\'' + brace + '\'}';
        });
      // If there's a newline in the text, adjust the indent level
      if (text.indexOf('\n') > -1) {
        text = text.replace(/\n\s*/g, this._getIndentedNewline());
      }
    }
    this.output += text;
  }
1203167
function(cloneNode){
							cloneNode.contentAssistProposalIndex = node.contentAssistProposalIndex;
							if (cloneNode.hasChildNodes()) {
								for (var i = 0 ; i < cloneNode.childNodes.length ; i++){
									recursiveSetIndex(cloneNode.childNodes[i]);
								}
							}
						}
333337
function copyHead(headHtml, doc) {
        var head = doc.getElementsByTagName('head')[0];

        if (head.innerHTML == headHtml) {
            // the content is already correct
            return;
        }

        jQuery.init(head).empty();

        appendHTML(headHtml, head);
    }
1176319
function (original, tag) {
      var nu = shallowAs(original, tag);

      // NOTE
      // previously this used serialisation:
      // nu.dom().innerHTML = original.dom().innerHTML;
      //
      // Clone should be equivalent (and faster), but if TD <-> TH toggle breaks, put it back.

      var cloneChildren = Traverse.children(deep(original));
      InsertAll.append(nu, cloneChildren);

      return nu;
    }
432005
function (event) {
        //event = $.event.fix(event); // jQuery event normalization.
        var element = this;//event.target;
        // @ TextNode -> nodeType == 3
        element = (element.nodeType == 3) ? element.parentNode : element;

        if (opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
            var target = element;//$(element);
            if (target.tagName == "INPUT" || target.tagName == "TEXTAREA") {
                return;
            }
        }
        var code = event.which,
            type = event.type,
            character = String.fromCharCode(code).toLowerCase(),
            special = that.special_keys[code],
            shift = event.shiftKey,
            ctrl = event.ctrlKey,
            alt = event.altKey,
            propagate = true, // default behaivour
            mapPoint = null;

        // in opera + safari, the event.target is unpredictable.
        // for example: 'keydown' might be associated with HtmlBodyElement
        // or the element where you last clicked with your mouse.
        if (opt.checkParent) {
//              while (!that.all[element] && element.parentNode){
            while (!element['hotkeys'] && element.parentNode) {
                element = element.parentNode;
            }
        }

//          var cbMap = that.all[element].events[type].callbackMap;
        var cbMap = element['hotkeys'].events[type].callbackMap;
        if (!shift && !ctrl && !alt) { // No Modifiers
            mapPoint = cbMap[special] || cbMap[character];
        }
        // deals with combinaitons (alt|ctrl|shift+anything)
        else {
            var modif = '';
            if (alt) modif += 'alt+';
            if (ctrl) modif += 'ctrl+';
            if (shift) modif += 'shift+';
            // modifiers + special keys or modifiers + characters or modifiers + shift characters
            mapPoint = cbMap[modif + special] || cbMap[modif + character] || cbMap[modif + that.shift_nums[character]];
        }
        if (mapPoint) {
            mapPoint.cb(event);
            if (!mapPoint.propagate) {
                event.stopPropagation();
                event.preventDefault();
                return false;
            }
        }
    }
493193
static function textArea($name, $value, $attr = array())
    {
        $html = "<textarea ";

        $attr = array_merge(
            array(
                "name" => $name
            ),
            $attr
        );

        $html .= self::getAttributes($attr);
        $html .= ">" . $value . '</textarea>';

        echo $html;
    }
16508
function clone(source) {
    var ret = {};
    for (var prop in source) {
      ret[prop] = source[prop];
    }
    return ret;
  }
1360773
function maybeWrapInJquery(val) {
        var transformedVal = val;

        // If the command is returning an `HTMLElement` or `HTMLDocument`, wrap it in a `jQuery` object
        /*jshint -W116*/
        if (val != null && typeof val === "object" &&
           (val.nodeType === 1 || val.nodeType === 9) && val.cloneNode) {

            transformedVal = $(val);
        }

        return transformedVal;
    }
962773
def jquery_update_text_value(self, selector, new_value, by=By.CSS_SELECTOR,
                                 timeout=settings.LARGE_TIMEOUT):
        
        if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
            timeout = self.__get_new_timeout(timeout)
        if page_utils.is_xpath_selector(selector):
            by = By.XPATH
        element = self.wait_for_element_visible(
            selector, by=by, timeout=timeout)
        self.__demo_mode_highlight_if_active(selector, by)
        self.scroll_to(selector, by=by)
        selector = self.convert_to_css_selector(selector, by=by)
        selector = self.__make_css_match_first_element_only(selector)
        selector = self.__escape_quotes_if_needed(selector)
        new_value = re.escape(new_value)
        new_value = self.__escape_quotes_if_needed(new_value)
        update_text_script = """jQuery('%s').val('%s')""" % (
            selector, new_value)
        self.safe_execute_script(update_text_script)
        if new_value.endswith('\n'):
            element.send_keys('\n')
        self.__demo_mode_pause_if_active()
207300
function fixClonedDom(clone, source) {
      // do nothing if cloned node is not an element
      if (!source.querySelectorAll) return;
      // these two lists should be coincident
      var s$ = QSA(source, TEMPLATE_TAG);
      if (s$.length === 0) {
        return;
      }
      var t$ = QSA(clone, TEMPLATE_TAG);
      for (var i=0, l=t$.length, t, s; i<l; i++) {
        s = s$[i];
        t = t$[i];
        if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {
          PolyfilledHTMLTemplateElement.decorate(s);
        }
        capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);
      }
    }
1277660
function(e) {
			var self = this;
			if (self.isFull() || self.isInputHidden || self.isLocked) {
				e.preventDefault();
			} else {
				// If a regex or string is included, this will split the pasted
				// input and create Items for each separate value
				if (self.settings.splitOn) {
					setTimeout(function() {
						var splitInput = $.trim(self.$control_input.val() || '').split(self.settings.splitOn);
						for (var i = 0, n = splitInput.length; i < n; i++) {
							self.createItem(splitInput[i]);
						}
					}, 0);
				}
			}
		}
80097
function clone(obj) {
  if (null == obj || "object" != typeof obj)
    return obj;

  if (obj instanceof Object) {
    var copy = {};
    for (var attr in obj) {
      if (obj.hasOwnProperty(attr)) copy[attr] = clone(obj[attr]);
    }
    return copy;
  }

  throw new Error("Unable to copy obj! Its type isn't supported.");
}
1198809
Object cloneReset() throws CloneNotSupportedException {
        // this method exists to enable 100% test coverage
        final StrTokenizer cloned = new StrTokenizer();

        if (this.chars != null) {
            cloned.chars = new char[this.chars.length];
            for (int i = 0; i < this.chars.length; i++) {
                cloned.chars[i] = this.chars[i];
            }
        }
        if (this.tokens == null) {
            cloned.tokens = null;
        } else {
            cloned.tokens = this.getTokenArray();
        }
        cloned.tokenPos = this.tokenPos;
        cloned.emptyAsNull = this.emptyAsNull;
        cloned.ignoreEmptyTokens = this.ignoreEmptyTokens;

        cloned.delimMatcher = this.delimMatcher;
        cloned.quoteMatcher = this.quoteMatcher;
        cloned.ignoredMatcher = this.ignoredMatcher;
        cloned.trimmerMatcher = this.trimmerMatcher;

        cloned.reset();
        return cloned;
    }
157546
function() {
    var options, name, src, copy, copyIsArray, clone,
      target = arguments[0] || {},
      i = 1,
      length = arguments.length,
      deep = true;

    // Handle case when target is a string or something (possible in deep copy)
    if (typeof target !== "object" && typeof target !== 'function') {
      target = {};
    }

    for (; i < length; i++) {
      // Only deal with non-null/undefined values
      if ((options = arguments[i]) !== null) {
        // Extend the base object
        for (name in options) {
          src = target[name];
          copy = options[name];

          // Prevent never-ending loop
          if (target === copy) {
            continue;
          }

          // Recurse if we're merging plain objects or arrays
          if (deep && copy && (copy.constructor == Object || (copyIsArray = (copy.constructor == Array)))) {
            if (copyIsArray) {
              copyIsArray = false;
              // Overwrite the source with a copy of the array to merge in
              clone = [];
            } else {
              clone = src && src.constructor == Object ? src : {};
            }

            // Never move original objects, clone them
            target[name] = Util.merge(clone, copy);

          // Don't bring in undefined values
          } else if (copy !== undefined) {
            target[name] = copy;
          }
        }
      }
    }

    // Return the modified object
    return target;
  }
757179
function TextareaState(input) {

  // Aliases
  var stateObj = this;
  var inputArea = input;
  this.init = function () {
    this.setInputAreaSelectionStartEnd();
    this.text = inputArea.getContent();
  };

  // Sets the selected text in the input box after we've performed an
  // operation.
  this.setInputAreaSelection = function () {
    inputArea.focus();
    inputArea.setSelection(stateObj.start, stateObj.end);
  };

  this.setInputAreaSelectionStartEnd = function () {
    stateObj.start = Math.min(
      inputArea.selectionMgr.selectionStart,
      inputArea.selectionMgr.selectionEnd
    );
    stateObj.end = Math.max(
      inputArea.selectionMgr.selectionStart,
      inputArea.selectionMgr.selectionEnd
    );
  };

  // Restore this state into the input area.
  this.restore = function () {

    if (stateObj.text !== undefined && stateObj.text != inputArea.getContent()) {
      inputArea.setContent(stateObj.text);
    }
    this.setInputAreaSelection();
  };

  // Gets a collection of HTML chunks from the inptut textarea.
  this.getChunks = function () {

    var chunk = new Chunks();
    chunk.before = util.fixEolChars(stateObj.text.substring(0, stateObj.start));
    chunk.startTag = "";
    chunk.selection = util.fixEolChars(stateObj.text.substring(stateObj.start, stateObj.end));
    chunk.endTag = "";
    chunk.after = util.fixEolChars(stateObj.text.substring(stateObj.end));

    return chunk;
  };

  // Sets the TextareaState properties given a chunk of markdown.
  this.setChunks = function (chunk) {

    chunk.before = chunk.before + chunk.startTag;
    chunk.after = chunk.endTag + chunk.after;

    this.start = chunk.before.length;
    this.end = chunk.before.length + chunk.selection.length;
    this.text = chunk.before + chunk.selection + chunk.after;
  };
  this.init();
}