Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add documentation example for Element.clone #92

Closed
wants to merge 1 commit into from

2 participants

@jwestbrook

No description provided.

@savetheclocktower
Collaborator

I ended up writing my own example based on this. Thanks!

@jwestbrook jwestbrook deleted the jwestbrook:documentation branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 28, 2012
  1. @jwestbrook
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/prototype/dom/dom.js
View
16 src/prototype/dom/dom.js
@@ -1145,6 +1145,22 @@
*
* A wrapper around DOM Level 2 `Node#cloneNode`, [[Element.clone]] cleans up
* any expando properties defined by Prototype.
+ *
+ * ##### Example
+ *
+ * With this HTML
+ *
+ * <div id="original">
+ * <div id="original_child"></div>
+ * </div>
+ *
+ * We can do this
+ *
+ * var singlediv = $('original').clone();
+ * // singlediv -> div#original
+ * var deepclone = $('original').clone(true);
+ * // deepclone -> div#original -> div#original_child
+ *
**/
function clone(element, deep) {
if (!(element = $(element))) return;
Something went wrong with that request. Please try again.