prototype: Element#wrap now returns the wrapper instead of the element being wrapped.

This commit is contained in:
Sam Stephenson 2007-10-11 06:11:26 +00:00
parent 115d3e456d
commit 4607e29fa2
3 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Element#wrap now returns the wrapper instead of the element being wrapped. [sam]
* Namespace all custom event names to avoid conflicts with native DOM events. [sam]
- All custom event names MUST include a namespace. Prefix custom event names for observe, stopObserving, and fire with the namespace followed by a colon. E.g. document.fire("widget:activated")
- The "contentloaded" event is now "dom:loaded".

View File

@ -153,7 +153,7 @@ Element.Methods = {
if (element.parentNode)
element.parentNode.replaceChild(wrapper, element);
wrapper.appendChild(element);
return element;
return wrapper;
},
inspect: function(element) {

View File

@ -569,6 +569,13 @@
assertEqual(orphan.parentNode, div);
}},
testElementWrapReturnsWrapper: function() {with(this) {
var element = new Element("div");
var wrapper = element.wrap("div");
assertNotEqual(element, wrapper);
assertEqual(element.up(), wrapper);
}},
testElementVisible: function(){with(this) {
assertNotEqual('none', $('test-visible').style.display);
assertEqual('none', $('test-hidden').style.display);