Add removeField
This commit is contained in:
parent
460ab16b93
commit
e0d86209ff
@ -111,6 +111,23 @@ class Serializer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* removeField
|
||||
*
|
||||
* @param {(HTMLElement|Serializer|SerializerField)} f Serializer child
|
||||
*/
|
||||
removeField(f){
|
||||
if(this._fields.has(f.name)){
|
||||
let fields = this._fields.get(f.name)
|
||||
if(Array.isArray(fields)){
|
||||
let index = fields.indexOf(f);
|
||||
this._fields.set(f.name, fields.splice(index, 1))
|
||||
} else {
|
||||
this._fields.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* serialize
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user