Differences
This shows you the differences between the selected revision and the current version of the page.
| mootorial:04-element:00-element 2010/05/13 20:36 | mootorial:04-element:00-element 2010/05/17 09:29 current | ||
|---|---|---|---|
| Line 279: | Line 279: | ||
| ===== Element.destroy ===== | ===== Element.destroy ===== | ||
| This is the same as Element.dispose, except it removes the element from memory so that it can no longer be referenced or re-injected into the DOM. | This is the same as Element.dispose, except it removes the element from memory so that it can no longer be referenced or re-injected into the DOM. | ||
| + | |||
| ===== Element.clone ===== | ===== Element.clone ===== | ||
| Line 288: | Line 289: | ||
| </code> | </code> | ||
| - | //Element.clone// takes an argument (a //boolean//): //true// will clone the node's children (this is the default), //false// will only clone the node: | + | //Element.clone// takes two arguments (both //boolean//s): //true// for the first one will clone the node's children (this is the default), //false// will only clone the node, and the second argument will keep the element's ID, otherwise the cloned node is returned without one (this is because it is not legal HTML to have to Elements in the DOM w/ the same ID): |
| <code javascript><div id="myElement"> | <code javascript><div id="myElement"> | ||
| Line 295: | Line 296: | ||
| <div id="childThree"></div> | <div id="childThree"></div> | ||
| </div> | </div> | ||
| - | <script>$('myElement').clone(false).inject('myElement');</script> | + | <script>$('myElement').clone(false, true).inject('myElement');</script> |
| resulting html: | resulting html: | ||
| <div id="myElement"> | <div id="myElement"> | ||
mootorial/04-element/00-element.txt · Last modified: 2010/05/17 09:29 by aaron-n