Sha256: ff7e44f2f7920a53bcd9194bfc0edf206f544b4df404a64c67e4842fff4d0633

Contents?: true

Size: 609 Bytes

Versions: 92

Compression:

Stored size: 609 Bytes

Contents

import { extend } from './util';
import { h } from './h';

/**
 * Clones the given VNode, optionally adding attributes/props and replacing its
 * children.
 * @param {import('./vnode').VNode} vnode The virtual DOM element to clone
 * @param {object} props Attributes/props to add when cloning
 * @param {Array<import('./vnode').VNode>} [rest] Any additional arguments will be used as replacement
 *  children.
 */
export function cloneElement(vnode, props) {
	return h(
		vnode.nodeName,
		extend(extend({}, vnode.attributes), props),
		arguments.length>2 ? [].slice.call(arguments, 2) : vnode.children
	);
}

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
govuk_publishing_components-17.21.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.20.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.19.1 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.19.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.18.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.17.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.16.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.15.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.14.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.13.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.12.2 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.12.1 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.12.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.11.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.10.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.9.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.8.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.7.0 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.6.1 node_modules/preact/src/clone-element.js
govuk_publishing_components-17.6.0 node_modules/preact/src/clone-element.js