Copy current content's contents to given target element
970233
def copy_contents_to(element)
      contents.map do |content|
        Content.copy(content, element_id: element.id)
      end
    end
1074930
def _setContent(self):
        '''
        '''
        kw = KW.copy()
        try:
            kw.update(dict(klass=self.getClassName(),
                       element='ElementDeclaration',
                       literal=self.literalTag(),
                       substitutionGroup=self._substitutionGroupTag(),
                       schema=self.schemaTag(), 
                       init=self.simpleConstructor(),
                       ns=self.ns, name=self.name,
                       aname=self.getAttributeName(self.name),  
                       baseslogic=self.getBasesLogic(ID3),
                       #ofwhat=self.getTypecodeList(),
                       #atypecode=self.attribute_typecode,
                       #pyclass=self.getPyClass(),
                       alias=NAD.getAlias(self.sKlassNS),
                       subclass=type_class_name(self.sKlass),
                       ))
        except Exception, ex:
            args = ['Failure processing an element w/local complexType: %s' %(
                          self._item.getItemTrace())]
            args += ex.args
            ex.args = tuple(args)
            raise
        
        if self.local:
            kw['element'] = 'LocalElementDeclaration'
        
        element = [
            '%(ID1)sclass %(klass)s(%(element)s):',
            '%(ID2)s%(literal)s',
            '%(ID2)s%(schema)s',
            '%(ID2)s%(substitutionGroup)s',
            '%(ID2)s%(init)s',
            '%(ID3)skw["pname"] = ("%(ns)s","%(name)s")',
            '%(ID3)skw["aname"] = "%(aname)s"',
            '%(baseslogic)s',
            '%(ID3)s%(alias)s.%(subclass)s.__init__(self, **kw)',
            '%(ID3)sif self.pyclass is not None: self.pyclass.__name__ = "%(klass)s_Holder"',
            ]

        self.writeArray(map(lambda l: l %kw, element))
115883
function() {

      var x, y, z, arr, edits, isEditable, configs, isConfig, el, html,li, parent, els, isDefault, removeElement, element, modal, body, attr, div, label, control, option, menuItem, els, text, block;


      // clean pasted text, #ref: http://bit.ly/1Tr8IR3
      document.addEventListener('paste', function(e) {

        if(e.target.nodeName == 'TEXTAREA') {
          // do nothing
        }
        else {
          // cancel paste
          e.preventDefault();

          // get text representation of clipboard
          var text = e.clipboardData.getData("text/plain");

          // insert text manually
          document.execCommand("insertHTML", false, text);
        }

      });


      // get contentEditable elements
      arr = document.querySelectorAll('body');

      for (x = 0; x < arr.length; x += 1) {

        // delegate CLICK, FOCUS event
        ['click', 'focus'].forEach(function(e) {

          arr[x].addEventListener(e, function(e) {

            if (e.target.hasAttribute('hashedit-element')) {
              element = e.target;

              // get value of text node
              var text = hashedit.getTextNodeValue(element);

              // if text is set to "Tap to update" select all the text
              if(text === hashedit.i18n('Tap to update')) {
                document.execCommand('selectAll', false, null);
              }

            }
            else {
              element = hashedit.findParentBySelector(e.target, '[hashedit-element]');
            }

            // remove all current elements
            els = document.querySelectorAll('[current-hashedit-element]');

            for (y = 0; y < els.length; y += 1) {
              els[y].removeAttribute('current-hashedit-element');
            }

            // set current element
            if (element) {
              element.setAttribute('current-hashedit-element', 'true');
            }

            // check for remove element
            if (e.target.matches('.hashedit-remove')  || hashedit.findParentBySelector(e.target, '.hashedit-remove') !== null) {
              element.remove();
            }
            // check for properties element
            else if (e.target.matches('.hashedit-properties')  ||  hashedit.findParentBySelector(e.target, '.hashedit-properties') !== null) {

              hashedit.current.node = element;

              isDefault = true;

              // get menuItem
              menuItem = null;

              // see if the element matches a plugin selector
              for (x = 0; x < hashedit.menu.length; x += 1) {

                if (element.matches(hashedit.menu[x].selector)) {

                  menuItem = hashedit.menu[x];

                  if (hashedit.menu[x].configure) {
                    isDefault = false;
                    hashedit.menu[x].configure();
                  }

                }

              }

              if (isDefault === true) {

                modal = document.getElementById('hashedit-element-settings-modal');
                body = modal.querySelector('.hashedit-modal-body');

                // remove existing custom attributes
                els = body.querySelectorAll('.hashedit-custom-attr');

                for(y=0; y<els.length; y++) {
                  els[y].parentNode.removeChild(els[y]);
                }

                // setup custom attributes
                if(menuItem != null) {

                  if(menuItem.attributes) {

                    for(y=0; y<menuItem.attributes.length; y++){

                      attr = menuItem.attributes[y];

                      div = document.createElement('div');
                      div.setAttribute('class', 'hashedit-custom-attr');

                      label = document.createElement('label');
                      label.innerHTML = attr.label;

                      div.appendChild(label);

                      if(attr.type == 'text'){
                        control = document.createElement('input');
                        control.setAttribute('type', 'text');
                        control.setAttribute('data-model', 'node.' + attr.attr);
                        control.setAttribute('name', 'attr');

                        div.appendChild(control);
                      }

                      if(attr.type == 'select'){
                        control = document.createElement('select');
                        control.setAttribute('data-model', 'node.' + attr.attr);
                        control.setAttribute('name', 'attr');

                        // create options
                        if(attr.values != null) {

                          for(z=0; z<attr.values.length; z++){

                            option = document.createElement('option');

                            // determine if hashed array
                            if(attr.values[z].text) {
                              option.setAttribute('value', attr.values[z].value);
                              option.innerHTML = attr.values[z].text;
                            }
                            else {
                              option.setAttribute('value', attr.values[z]);
                              option.innerHTML = attr.values[z];
                            }

                            control.appendChild(option);
                          }

                        }

                        div.appendChild(control);

                      }

                      body.appendChild(div);

                    }


                  }

                }

                // bind
                hashedit.bind();

                // show modal
                modal.setAttribute('visible', 'true');

              }

            }
            // add block
            else if (e.target.matches('.hashedit-block-add') || hashedit.findParentBySelector(e.target, '.hashedit-block-add') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');

              if(block !== null) {
                hashedit.showLayoutDialog(block);
              }

            }
            // properites block
            else if (e.target.matches('.hashedit-block-properties') || hashedit.findParentBySelector(e.target, '.hashedit-block-properties') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');

              if(block !== null) {

                var modal = document.getElementById('hashedit-block-settings-modal');

                // show modal
                modal.setAttribute('visible', 'true');

                hashedit.current.node = block;
                hashedit.bind();

              }

            }
            // move block up
            else if (e.target.matches('.hashedit-block-up') ||  hashedit.findParentBySelector(e.target, '.hashedit-block-up') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');

              if(block.previousElementSibling != null) {

                if(block.previousElementSibling.hasAttribute('hashedit-block') === true) {
                  block.parentNode.insertBefore(block, block.previousElementSibling);
                }

              }

              hashedit.setupBlocks();

            }
            // move block down
            else if (e.target.matches('.hashedit-block-down') ||  hashedit.findParentBySelector(e.target, '.hashedit-block-down') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');

              if(block.nextElementSibling != null) {

                if(block.nextElementSibling.hasAttribute('hashedit-block') === true) {
                  block.nextElementSibling.parentNode.insertBefore(block.nextElementSibling, block);
                }

              }

              hashedit.setupBlocks();

            }
            // remove block
            else if (e.target.matches('.hashedit-block-remove') ||  hashedit.findParentBySelector(e.target, '.hashedit-block-remove') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');
              block.remove();

              hashedit.setupBlocks();

            }
            // remove block
            else if (hashedit.findParentBySelector(e.target, '.hashedit-block-duplicate') !== null) {

              block = hashedit.findParentBySelector(e.target, '[hashedit-block]');

              hashedit.duplicateBlock(block, 'before');

              hashedit.setupBlocks();

            }
            // handle links
            else if (e.target.nodeName == 'A') {

                // hide .hashedit-config, .hashedit-modal
                edits = document.querySelectorAll('[hashedit]');

                // determines whether the element is a configuration
                isEditable = false;

                for (x = 0; x < edits.length; x += 1) {

                  if (edits[x].contains(e.target) === true) {
                    isEditable = true;
                  }

                }

                if (isEditable) {
                  hashedit.showLinkDialog();
                }
            }
            else if (e.target.nodeName == 'IMG') {
                hashedit.current.node = e.target;
                hashedit.current.image = e.target;

                // hide .hashedit-config, .hashedit-modal
                edits = document.querySelectorAll('[hashedit]');

                // determines whether the element is a configuration
                isEditable = false;

                for (x = 0; x < edits.length; x += 1) {

                  if (edits[x].contains(e.target) === true) {
                    isEditable = true;
                  }

                }

                if (isEditable) {
                  hashedit.showImageDialog();
                }
            }
            else if (e.target.hasAttribute('contentEditable')) {

              // shows the text options
              hashedit.showTextOptions(e.target);

            }
            else if (e.target.parentNode.hasAttribute('contentEditable') && e.target.parentNode) {

              // shows the text options
              hashedit.showTextOptions(e.target);

            }
            else if (e.target.className == 'dz-hidden-input') {
              // do nothing
            }
            else {
              // hide .hashedit-config, .hashedit-modal
              configs = document.querySelectorAll(
                '.hashedit-config, .hashedit-modal, .hashedit-menu'
              );

              // determines whether the element is a configuration
              isConfig = false;

              for (x = 0; x < configs.length; x += 1) {

                if (configs[x].contains(e.target) === true) {
                  isConfig = true;
                }

              }

              // hide if not in config
              if (isConfig === false) {

                for (x = 0; x < configs.length; x += 1) {
                  configs[x].removeAttribute('visible');
                }

              }
            }

          });

        });


        // delegate INPUT event
        ['input'].forEach(function(e) {
          arr[x].addEventListener(e, function(e) {

            if (e.target.hasAttribute('contentEditable')) {

              el = e.target;

              while (el !== null) {

                var node = el.childNodes[0];

                if (hashedit.debug === true) {
                  console.log('input event');
                  console.log(el.nodeName);
                }

                // get value of text node
                var text = hashedit.getTextNodeValue(el);

                // if text is blank and the element has only one child node, add "Tap to update" to prevent the editor from breaking
                if(text === '' && el.childNodes.length == 1) {
                  text = document.createTextNode(hashedit.i18n('Tap to update'));
                  el.insertBefore(text, el.firstChild);
                  document.execCommand('selectAll', false, null);
                }

                html = el.innerHTML;

                // strip out &nbsps
                html = hashedit.replaceAll(html, '&nbsp;', ' ');

                // trim
                html = html.trim();

                // set to null
                el = null;
              }

            }


          });

        });

        // delegate INPUT event
        ['keydown'].forEach(function(e) {
          arr[x].addEventListener(e, function(e) {

            if (e.target.hasAttribute('contentEditable')) {

              el = e.target;

              // ENTER key
              if (e.keyCode === 13) {

                if (el.nodeName == 'LI') {

                  // create LI
                  li = document.createElement('li');
                  li.setAttribute('contentEditable', true);

                  // append LI
                  el.parentNode.appendChild(li);

                  el.parentNode.lastChild.focus();

                  e.preventDefault();
                  e.stopPropagation();

                }
                else if (el.nodeName == 'P') {

                  var node = hashedit.append('<p>' + hashedit.i18n('Tap to update') + '</p>');

                  hashedit.current.node = node;


                  e.preventDefault();
                  e.stopPropagation();

                }

              }

              // DELETE key
              if (e.keyCode === 8) {

                if (el.nodeName == 'LI') {

                  if (el.innerHTML === '') {

                    if (el.previousSibling !== null) {

                      parent = el.parentNode;

                      el.remove();

                      parent.lastChild.focus();
                    }

                    e.preventDefault();
                    e.stopPropagation();
                  }

                } // end LI

              }

            }


          });

        });

      }

    }
1222018
function( target ) {
				var selector = target.nodeName.toLowerCase();
				if(target.id){
					return "#"+target.id
				}else{
					var parent = target.parentNode;
					while(parent){
						if(parent.id){
							selector = "#"+parent.id+" "+selector;
							break;
						}else{
							parent = parent.parentNode
						}
					}
				}
				if(target.className){
					selector += "."+target.className.split(" ")[0]
				}
				var others = jQuery(selector, Syn.helpers.getWindow(target).document)
				if(others.length > 1){
					return selector+":eq("+others.index(target)+")";
				}else{
					return selector;
				}
				
				
			}
125325
def copyProp(self, target):
        
        if target is None: target__o = None
        else: target__o = target._o
        ret = libxml2mod.xmlCopyProp(target__o, self._o)
        if ret is None:raise treeError('xmlCopyProp() failed')
        __tmp = xmlAttr(_obj=ret)
        return __tmp
1000133
function copySourceContent(filename) {
    var content = consumer.sourceContentFor(filename);
    if (content) {
      generator.setSourceContent(filename, content);
    }
  }
589076
function setNodeContent(node, content) {
	// find caret position and replace it with content, if possible
	if (node.value) {
		const ranges = findUnescapedTokens(node.value, caret);
		if (ranges.length) {
			node.value = replaceRanges(node.value, ranges, content);
			return;
		}
	}

	if ((node.name && node.name.toLowerCase() === 'a') || node.hasAttribute('href')) {
		// special case: inserting content into `<a>` tag
		if (reUrl.test(content)) {
			node.setAttribute('href', (reProto.test(content) ? '' : 'http://') + content);
		} else if (reEmail.test(content)) {
			node.setAttribute('href', 'mailto:' + content);
		}
	}

	node.value = content;
}
569288
function copyToOut(src, out, multiFileMode) {
    try {
        fs.copySync(src, out);
        fs.statSync(out)
        return out;
    } catch (err) {
    }
}
52550
def copy_nested_elements_to(target_element)
      nested_elements.map do |nested_element|
        Element.copy(nested_element, {
          parent_element_id: target_element.id,
          page_id: target_element.page_id
        })
      end
    end
384373
function() {
			var self = this;
			var target = $(self.scope.source);
			var content = '';

			if (target.length) {
				content = target.contents().detach();
				target.empty();
			} else {
				content = 'Content could not be loaded. Please check the source and try again.';
			}

			// now push content into markup
			self.build_modal(content);
		}
1269739
function(content) {
		
		// clone if asked. Cloning the object makes sure that each instance has its
		// own version of the content (in case a same object were provided for several
		// instances)
		// reminder: typeof null === object
		if (content instanceof $ && this.__options.contentCloning) {
			content = content.clone(true);
		}
		
		this.__Content = content;
		
		this._trigger({
			type: 'updated',
			content: content
		});
		
		return this;
	}
1082749
function storeTmplItems( content ) {
		var keySuffix = "_" + cloneIndex, elem, elems, newClonedItems = {}, i, l, m;
		for ( i = 0, l = content.length; i < l; i++ ) {
			if ( (elem = content[i]).nodeType !== 1 ) {
				continue;
			}
			elems = elem.getElementsByTagName("*");
			for ( m = elems.length - 1; m >= 0; m-- ) {
				processItemKey( elems[m] );
			}
			processItemKey( elem );
		}
		function processItemKey( el ) {
			var pntKey, pntNode = el, pntItem, tmplItem, key;
			// Ensure that each rendered template inserted into the DOM has its own template item,
			if ( (key = el.getAttribute( tmplItmAtt ))) {
				while ( pntNode.parentNode && (pntNode = pntNode.parentNode).nodeType === 1 && !(pntKey = pntNode.getAttribute( tmplItmAtt ))) { }
				if ( pntKey !== key ) {
					// The next ancestor with a _tmplitem expando is on a different key than this one.
					// So this is a top-level element within this template item
					// Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment.
					pntNode = pntNode.parentNode ? (pntNode.nodeType === 11 ? 0 : (pntNode.getAttribute( tmplItmAtt ) || 0)) : 0;
					if ( !(tmplItem = newTmplItems[key]) ) {
						// The item is for wrapped content, and was copied from the temporary parent wrappedItem.
						tmplItem = wrappedItems[key];
						tmplItem = newTmplItem( tmplItem, newTmplItems[pntNode]||wrappedItems[pntNode], null, true );
						tmplItem.key = ++itemKey;
						newTmplItems[itemKey] = tmplItem;
					}
					if ( cloneIndex ) {
						cloneTmplItem( key );
					}
				}
				el.removeAttribute( tmplItmAtt );
			} else if ( cloneIndex && (tmplItem = jQuery.data( el, "tmplItem" )) ) {
				// This was a rendered element, cloned during append or appendTo etc.
				// TmplItem stored in jQuery data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
				cloneTmplItem( tmplItem.key );
				newTmplItems[tmplItem.key] = tmplItem;
				pntNode = jQuery.data( el.parentNode, "tmplItem" );
				pntNode = pntNode ? pntNode.key : 0;
			}
			if ( tmplItem ) {
				pntItem = tmplItem;
				// Find the template item of the parent element. 
				// (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
				while ( pntItem && pntItem.key != pntNode ) { 
					// Add this element as a top-level node for this rendered template item, as well as for any
					// ancestor items between this item and the item of its parent element
					pntItem.nodes.push( el );
					pntItem = pntItem.parent;
				}
				// Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
				delete tmplItem._ctnt;
				delete tmplItem._wrap;
				// Store template item as jQuery data on the element
				jQuery.data( el, "tmplItem", tmplItem );
			}
			function cloneTmplItem( key ) {
				key = key + keySuffix;
				tmplItem = newClonedItems[key] = 
					(newClonedItems[key] || newTmplItem( tmplItem, newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent, null, true ));
			}
		}
	}
268801
function copy(source, target) {
  for (var name in source) {
    if (source.hasOwnProperty(name)) {
      target[name] = source[name];
    }
  }
}
495468
protected function copyElement(DOMElement $source, DOMElement $target)
	{
		if ($source->hasAttributes())
		{
			$attributes = $source->attributes;
			if (!is_null($attributes))
			{
				foreach ($attributes as $attr)
				{
					$target->setAttribute($attr->name, $attr->value);
				}
			}
		}

		foreach ($source->childNodes as $child)
		{
			$target->appendChild($child->cloneNode(true));
		}
	}
1010311
public static void copyToClipboard(String content) {
        if (content == null) {
            return;
        }
        Clipboard cb = null;
        try {
            cb = new Clipboard(Display.getDefault());
            cb.setContents(new String[] { content }, new TextTransfer[] { TextTransfer.getInstance() });
        } finally {
            if (cb != null) {
                cb.dispose();
            }
        }
    }
1374541
function copyToClipBoard(content) {
  switch (process.platform) {
  case 'darwin':
    var child = spawn('pbcopy', []);
    child.stdin.end(new Buffer(content, 'utf8'));
    return true;
  default:
    return false;
  }
}
389071
function(target, targetOffset, offset, length) {
    // eslint-disable-next-line no-underscore-dangle
    return this._data._buf.copy(target, targetOffset, offset, length);
  }