|
|
@ -12,7 +12,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
<h1>insert</h1> |
|
|
|
<h1>insert</h1> |
|
|
|
|
|
|
|
|
|
|
|
<p><button id="insert">Insert</button> <button id="append">Append</button></p> |
|
|
|
<p> |
|
|
|
|
|
|
|
<button id="prepend">Prepend</button> |
|
|
|
|
|
|
|
<button id="insert">Insert</button> |
|
|
|
|
|
|
|
<button id="append">Append</button> |
|
|
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
|
|
|
|
<div id="container"> |
|
|
|
<div id="container"> |
|
|
|
<div class="item"><b>49</b></div> |
|
|
|
<div class="item"><b>49</b></div> |
|
|
@ -60,8 +64,13 @@ docReady( function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eventie.bind( document.querySelector('#prepend'), 'click', function() { |
|
|
|
|
|
|
|
// prepend 3 new items |
|
|
|
|
|
|
|
iso.prepended( [ prependItem(), prependItem(), prependItem() ] ); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
eventie.bind( document.querySelector('#insert'), 'click', function() { |
|
|
|
eventie.bind( document.querySelector('#insert'), 'click', function() { |
|
|
|
// append 3 new items |
|
|
|
// insert 3 new items |
|
|
|
iso.insert( [ getItem(), getItem(), getItem() ] ); |
|
|
|
iso.insert( [ getItem(), getItem(), getItem() ] ); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -78,6 +87,12 @@ docReady( function() { |
|
|
|
return item; |
|
|
|
return item; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function prependItem() { |
|
|
|
|
|
|
|
var item = getItem(); |
|
|
|
|
|
|
|
container.insertBefore( item, container.firstChild ); |
|
|
|
|
|
|
|
return item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function appendItem() { |
|
|
|
function appendItem() { |
|
|
|
var item = getItem(); |
|
|
|
var item = getItem(); |
|
|
|
container.appendChild( item ); |
|
|
|
container.appendChild( item ); |
|
|
@ -96,8 +111,6 @@ var getText = docElem.textContent ? |
|
|
|
return elem.innerText; |
|
|
|
return elem.innerText; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
</body> |
|
|
|
</body> |
|
|
|