Permalink
Browse files

added tests

added tests, fixed some spacing, precedence issues
  • Loading branch information...
1 parent 5b0f63c commit 4a18190604e29557f5ac7e89853810a79f2c64db Cristian Carlesso committed Jul 30, 2012
Showing with 20 additions and 2 deletions.
  1. +4 −2 Source/Element/Element.js
  2. +16 −0 Specs/1.4client/Element/Element.js
@@ -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){
@@ -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');

0 comments on commit 4a18190

Please sign in to comment.