Merge "Fix up 62d08588050f576b0728800067b97d41b7eec9fa"

This commit is contained in:
Trevor Parscal 2012-08-10 17:31:56 +00:00 committed by Gerrit Code Review
commit 17bf3ef756

View file

@ -46,7 +46,7 @@ ve.dm.TextStyleAnnotation.converters = {
return $( document.createElement( map[subType] ) )
// Restore HTML attributes
// Will be done for us in the new annotation API
.attr( annotation.htmlAttributes )
.attr( annotation.htmlAttributes || {} )
.get( 0 );
},
'toDataAnnotation': function ( tag, element ) {
@ -67,12 +67,15 @@ ve.dm.TextStyleAnnotation.converters = {
};
annotation = {
type: 'textStyle/' + map[tag],
htmlAttributes: {}
};
// Preserve HTML attributes
// Will be done for us in the new annotation API
for ( i = 0, length = element.attributes.length; i < length; i++ ) {
annotation.htmlAttributes[element.attributes[i].name] = element.attributes[i].value;
length = element.attributes.length;
if ( length > 0 ) {
annotation.htmlAttributes = {};
for ( i = 0; i < length; i++ ) {
annotation.htmlAttributes[element.attributes[i].name] = element.attributes[i].value;
}
}
return annotation;
}