Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
added tests, fixed some spacing, precedence issues
  • Loading branch information
Cristian Carlesso authored and Cristian Carlesso committed Jul 30, 2012
1 parent 5b0f63c commit 4a18190
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Element/Element.js
Expand Up @@ -820,13 +820,15 @@ Element.implement({
contents = contents !== false;
var oldID;
/*<ltIE8>*/
if(Browser.ie6 || Browser.ie7 && !keepid){
if (Browser.ie6 || Browser.ie7 && !keepid){
oldID = this.removeAttribute('id');
}
/*</ltIE8>*/
var clone = this.cloneNode(contents), ce = [clone], te = [this], i;
/*<ltIE8>*/
oldID && Browser.ie6 || Browser.ie7 && this.setAttribute('id', oldID);
if (oldID && (Browser.ie6 || Browser.ie7)){
this.setAttribute('id', oldID);
}
/*</ltIE8>*/

if (contents){
Expand Down
16 changes: 16 additions & 0 deletions Specs/1.4client/Element/Element.js
Expand Up @@ -9,6 +9,22 @@ provides: [Element.Event.Specs]
describe('Element', function(){

describe('Element.getProperty', function(){
it('should cloneNode properly on IE6/7', function(){
var div = new Element('div');
div.innerHTML = "<input id='Q1' class='foo' rel='hai' />​";

var div = new Element('div');
div.inject(document.documentElement);
div.innerHTML = "<input id='Q1' class='foo' rel='hai' />";

var q1 = document.id('Q1');
var clone = q1.clone();
clone.replaces(q1);

expect($$('input[id=Q1]').length).toEqual(0)
expect($$('input#Q1').length).toEqual(0)
clone.dispose();
})

it('should get the attrubte of a form when the form has an input with as ID the attribute name', function(){
var div = new Element('div');
Expand Down

0 comments on commit 4a18190

Please sign in to comment.