Changeset 6639
- Timestamp:
- 04/30/07 09:57:28 (2 years ago)
- Files:
-
- spinoffs/prototype/branches/dom/CHANGELOG (modified) (1 diff)
- spinoffs/prototype/branches/dom/src/dom.js (modified) (1 diff)
- spinoffs/prototype/branches/dom/test/unit/dom.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinoffs/prototype/branches/dom/CHANGELOG
r6638 r6639 1 1 *SVN* 2 3 * Add Element#wrap which wraps the element inside a new one. Closes #5732. [P. Vande, Tobie Langel] 2 4 3 5 * Make Element into a constructor: new Element(tagName, attributes). Add Element#writeAttribute which accepts a hash of attributes or a name/value pair. Closes #7476. [Mislav Marohnić, haraldmartin, Tobie Langel] spinoffs/prototype/branches/dom/src/dom.js
r6638 r6639 171 171 } 172 172 content.evalScripts.bind(content).defer(); 173 return element; 174 }, 175 176 wrap: function(element, wrapper) { 177 element = $(element); 178 wrapper = wrapper || 'div'; 179 if(typeof wrapper == 'string') wrapper = new Element(wrapper); 180 else Element.extend(wrapper); 181 element.parentNode.replaceChild(wrapper, element); 182 wrapper.appendChild(element); 173 183 return element; 174 184 }, spinoffs/prototype/branches/dom/test/unit/dom.html
r6638 r6639 403 403 assert(getInnerHTML('element-insertions-main').endsWith('some backward-compatibility testing bottom')); 404 404 }}, 405 405 406 testElementWrap: function() {with(this) { 407 var element = $('wrap'), parent = document.createElement('div'); 408 element.wrap('div'); 409 assert(getInnerHTML('wrap-container').startsWith('<div><p')); 410 element.wrap(parent); 411 assert(getInnerHTML('wrap-container').startsWith('<div><div><p')); 412 assert(typeof parent.setStyle == 'function'); 413 element.wrap(); 414 assert(getInnerHTML('wrap-container').startsWith('<div><div><div><p')); 415 }}, 416 406 417 testElementVisible: function(){with(this) { 407 418 assertNotEqual('none', $('test-visible').style.display);