/** * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ /** * @module engine/view/containerelement */ import Element from './element'; /** * Containers are elements which define document structure. They define boundaries for * {@link module:engine/view/attributeelement~AttributeElement attributes}. They are mostly use for block elements like `
` or `
` is an container and `` is attribute: * *
fo^o
* * {@link module:engine/view/writer~writer.breakAttributes breakAttributes} will create: * *foo
* * There might be a need to mark `` element as a container node, for example in situation when it will be a * container of an inline widget: * * foobar // attribute * foobar // container * * @extends module:engine/view/element~Element */ export default class ContainerElement extends Element { /** * Creates a container element. * * @see module:engine/view/element~Element */ constructor( name, attrs, children ) { super( name, attrs, children ); /** * Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed. * * @method #getFillerOffset * @returns {Number|null} Block filler offset or `null` if block filler is not needed. */ this.getFillerOffset = getFillerOffset; } } // Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed. // // @returns {Number|null} Block filler offset or `null` if block filler is not needed. function getFillerOffset() { /*jshint validthis:true */ return this.childCount === 0 ? 0 : null; }