blob: 82ee0ae544343a01b86510b434cf1c477c98cba2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import { register } from '../utils/adopter.js'
import Element from './Element.js'
export default class Container extends Element {
flatten ( parent ) {
this.each( function () {
if ( this instanceof Container ) return this.flatten( parent ).ungroup( parent )
return this.toParent( parent )
} )
// we need this so that the root does not get removed
this.node.firstElementChild || this.remove()
return this
}
ungroup ( parent ) {
parent = parent || this.parent()
this.each( function () {
return this.toParent( parent )
} )
this.remove()
return this
}
}
register( Container )
|