Inline and added create methods

This commit is contained in:
Richard Davey 2018-07-19 00:42:28 +01:00
parent ceb466748a
commit e2dbbcdbb0

View file

@ -115,7 +115,7 @@ var DOMElement = new Class({
this.node = target; this.node = target;
target.style.zIndex = '0'; target.style.zIndex = '0';
target.style.display = 'block'; target.style.display = 'inline';
target.style.position = 'absolute'; target.style.position = 'absolute';
if (this.parent) if (this.parent)
@ -130,6 +130,22 @@ var DOMElement = new Class({
return this; 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) setText: function (text)
{ {
if (this.node) if (this.node)