mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-18 04:32:28 -05:00
Clone all attributes when replacing tags
This makes it more likely to preserve the visual result.
This commit is contained in:
parent
2cfba2cf1d
commit
af93577405
1 changed files with 6 additions and 0 deletions
|
@ -70,6 +70,12 @@ var styleToSemantic = {
|
||||||
var replaceWithTag = function ( tag ) {
|
var replaceWithTag = function ( tag ) {
|
||||||
return function ( node, parent ) {
|
return function ( node, parent ) {
|
||||||
var el = createElement( node.ownerDocument, tag );
|
var el = createElement( node.ownerDocument, tag );
|
||||||
|
var attributes = node.attributes;
|
||||||
|
var i, l, attribute;
|
||||||
|
for ( i = 0, l = attributes.length; i < l; i += 1 ) {
|
||||||
|
attribute = attributes[i];
|
||||||
|
el.setAttribute( attribute.name, attribute.value );
|
||||||
|
}
|
||||||
parent.replaceChild( el, node );
|
parent.replaceChild( el, node );
|
||||||
el.appendChild( empty( node ) );
|
el.appendChild( empty( node ) );
|
||||||
return el;
|
return el;
|
||||||
|
|
Loading…
Add table
Reference in a new issue