From e2dbbcdbb0440279e05c92d6c56b705254cca373 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 19 Jul 2018 00:42:28 +0100 Subject: [PATCH] Inline and added create methods --- src/gameobjects/domelement/DOMElement.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gameobjects/domelement/DOMElement.js b/src/gameobjects/domelement/DOMElement.js index 22ecc1925..a068aead4 100644 --- a/src/gameobjects/domelement/DOMElement.js +++ b/src/gameobjects/domelement/DOMElement.js @@ -115,7 +115,7 @@ var DOMElement = new Class({ this.node = target; target.style.zIndex = '0'; - target.style.display = 'block'; + target.style.display = 'inline'; target.style.position = 'absolute'; if (this.parent) @@ -130,6 +130,22 @@ var DOMElement = new Class({ return this; }, + createFromCache: function (key, elementType) + { + return this.createFromHTML(this.scene.sys.cache.text.get(key), elementType); + }, + + createFromHTML: function (html, elementType) + { + if (elementType === undefined) { elementType = 'div'; } + + var element = document.createElement(elementType); + + element.innerHTML = html; + + return this.setElement(element); + }, + setText: function (text) { if (this.node)