Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added tests

added tests, fixed some spacing, precedence issues
  • Loading branch information...
commit 4a18190604e29557f5ac7e89853810a79f2c64db 1 parent 5b0f63c
Cristian Carlesso authored
Showing with 20 additions and 2 deletions.
  1. +4 −2 Source/Element/Element.js
  2. +16 −0 Specs/1.4client/Element/Element.js
View
6 Source/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){
View
16 Specs/1.4client/Element/Element.js
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.