| 1 | /** |
| 2 | * @private |
| 3 | * @class mw.plugin.page.ready |
| 4 | */ |
| 5 | |
| 6 | const ID = 'mw-teleport-target'; |
| 7 | |
| 8 | const target = document.createElement( 'div' ); |
| 9 | target.id = ID; |
| 10 | |
| 11 | /** |
| 12 | * Manages a dedicated container element for modals and dialogs. |
| 13 | * |
| 14 | * This creates an empty div and attaches it to the end of the body element. |
| 15 | * This div can be used by Codex Dialogs and similar components that |
| 16 | * may need to be displayed on the page. |
| 17 | * |
| 18 | * Skins should apply body content styles to this element so that |
| 19 | * dialogs will use the same styles (font sizes, etc). |
| 20 | * |
| 21 | * @ignore |
| 22 | * @return {Object} |
| 23 | * @return {HTMLDivElement} return.target The div element |
| 24 | * @return {Function} return.attach Call this function to attach the div to the <body> |
| 25 | */ |
| 26 | module.exports = { |
| 27 | target, |
| 28 | attach() { |
| 29 | document.body.appendChild( target ); |
| 30 | } |
| 31 | }; |