Ticket #2389: 2389.2.patch
File 2389.2.patch, 2.9 KB (added by , 16 years ago) |
---|
-
fckdomtools.js
507 507 }, 508 508 509 509 /** 510 * Copy all attributes of the element to an array. 511 * Fix is specific to ticket #2389 but could probably be used in other scenarios. 512 */ 513 CopyAttributesToArray : function ( element ) 514 { 515 var elementAttributes = {} ; 516 var oAttributes = element.attributes; 517 518 for ( var i = 0 ; i < oAttributes.length ; i++ ) 519 { 520 // Check for "specified" attributes on the row element 521 if( oAttributes.item(i).specified ) 522 { 523 elementAttributes[oAttributes.item(i).nodeName] = this.GetAttributeValue( element, oAttributes.item(i).nodeName ) ; 524 } 525 } 526 return elementAttributes ; 527 }, 528 529 /** 530 * Generic function used to set attribute values of DOM elements. 531 */ 532 SetAttributeValue : function( element, attributeName, attributeValue ) 533 { 534 // Workaround for IE when setting the "style" or "class" attributes. 535 if ( FCKBrowserInfo.IsIE && attributeName == 'style' ) 536 element.style.cssText = attributeValue; 537 else if ( FCKBrowserInfo.IsIE && attributeName == 'class' ) 538 element.setAttribute( 'className', attributeValue ) ; 539 else 540 element.setAttribute( attributeName, attributeValue ) ; 541 }, 542 543 /** 510 544 * Remove an attribute from an element. 511 545 */ 512 546 RemoveAttribute : function( element, attributeName ) -
fcktablehandler.js
685 685 // as the cell is not attached to a row. So we'll need an alternative attribute 686 686 // for storing the calculated rowSpan in IE. 687 687 var rowSpanAttr = FCKBrowserInfo.IsIE ? "_fckrowspan" : "rowSpan" ; 688 688 689 // Get all row attributes 690 var rowAttributes = [] ; 691 var rowCount = 0 ; 692 var skipRowAttributes = true ; 693 689 694 // Clear the table of all rows first. 690 695 while ( table.rows.length > 0 ) 691 696 { 692 697 var row = table.rows[0] ; 698 699 // Get all row attributes before deleting the row 700 if ( FCKDomTools.HasAttributes ( row ) ) 701 { 702 skipRowAttributes = false ; 703 rowAttributes[rowCount] = FCKDomTools.CopyAttributesToArray ( row ); 704 rowCount++ ; 705 } 706 693 707 row.parentNode.removeChild( row ) ; 694 708 } 695 709 … … 765 779 for ( var i = 0 ; i < tableMap.length ; i++ ) 766 780 { 767 781 var rowObj = FCKTools.GetElementDocument( table ).createElement( 'tr' ) ; 782 783 if ( !skipRowAttributes ) 784 { 785 // Set attributes previously stored in the array 786 var attributeList = rowAttributes[i]; 787 for ( var attributeName in attributeList ) 788 { 789 FCKDomTools.SetAttributeValue( rowObj, attributeName , attributeList[attributeName] ) ; 790 } 791 } 792 768 793 for ( var j = 0 ; j < tableMap[i].length ; ) 769 794 { 770 795 var cell = tableMap[i][j] ;