mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
Merge "Check values property exists before removing attribute"
This commit is contained in:
commit
fc3ea799df
|
@ -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 ) {
|
||||||
|
|
Loading…
Reference in a new issue