Merge "Check values property exists before removing attribute"

This commit is contained in:
jenkins-bot 2013-12-13 19:39:42 +00:00 committed by Gerrit Code Review
commit fc3ea799df

View file

@ -279,10 +279,12 @@ ve.dm.Model.static.removeHtmlAttribute = function ( dataElement, attribute ) {
function removeAttributeRecursive( children ) { function removeAttributeRecursive( children ) {
var i; var i;
for ( i = 0; i < children.length; i++ ) { for ( i = 0; i < children.length; i++ ) {
if ( children[i].values ) {
delete children[i].values[attribute]; delete children[i].values[attribute];
if ( ve.isEmptyObject( children[i].values ) ) { if ( ve.isEmptyObject( children[i].values ) ) {
delete children[i].values; delete children[i].values;
} }
}
if ( children[i].children ) { if ( children[i].children ) {
removeAttributeRecursive( children[i].children ); removeAttributeRecursive( children[i].children );
if ( !children[i].children.length ) { if ( !children[i].children.length ) {