How to use the ko/dom.create function in ko

To help you get started, we’ve selected a few ko examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / wizard.js View on Github external
this.init = function($element = {}, options = {})
        {
            // The only arg passed in might only be options
            if (!$element.koDom)
            {
                options = $element;
            }
            var newElem = $.create(this.type, options.attributes || {})
            var $newElem = $(newElem.toString());
            // if content has been provided append it to the element
            if($element && $element.koDom)
            {
                $newElem.append($element);
            }
            this.$elem = $newElem; // koDom object
            this.element = this.$elem.element.bind(this.$elem); // Actual DOM object
        };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / shell.js View on Github external
var showOutputInHud = function(process, command)
    {
        var running = true;

        // Create the output panel
        var hud =
        $($.create("panel", {class: "hud shell-output", noautohide: true, width: 500, level: "floating"},
            $.create("textbox", {multiline: true, rows: 15, readonly: true, style: "max-width: 490px"})
                    ("button", {label: "stop"})
        ).toString());

        // Append command name if given
        if (command)
            hud.prepend($.create("label", {value: "$ " + command}).toString());

        // Append to DOM
        $("#komodoMainPopupSet").append(hud);

        // Center the panel on the editor
        var elem = hud.element();
        var bo = w.document.getElementById('komodo-editor-vbox');
        bo = bo ? bo.boxObject : w.document.documentElement.boxObject;
        var left = (bo.x + (bo.width / 2)) - (elem.width / 2);
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / radiogroup.js View on Github external
{
                options = label;
                label = null;
            }
            else if (label)
            {
                options.label = label;
            }
            
            this.options = options;
            this.attributes = attributes;
            this.$element = $($.create(this.name).toString());
            this.$element.addClass("ui-radiogroup-wrapper");
            this.element = this.$element.element();
            
            this.$formElement = $($.create("radiogroup", attributes).toString());
            this.$formElement.addClass("ui-radiogroup");
            this.formElement = this.$formElement.element();
            this.$element.append(this.formElement);
            
            if (options.label)
            {
                this.$element.prepend(require("./label").create(options.label).element);
            }
            var radioBtns = options.options;
            if (radioBtns && Array.isArray(radioBtns))
            {
                this.addRadioItems(radioBtns)
            }
            else if (radioBtns && ! Array.isArray(radioBtns))
            {
                log.warn("Radio items must be in an array.  Failed to add menu "+
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / list.js View on Github external
this.init = function(entries, options = {})
        {
            this.parseOptions(options);

            this.$element = $($.create(this.name, this.attributes).toString());
            this.$element.addClass("ui-list");
            this.element = this.$element.element();
            
            this.addEntries(entries);
        };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / richlistbox.js View on Github external
{
            if ( ! Array.isArray(richlistitems) && typeof richlistitems == "object")
            {
                options = richlistitems;
                richlistitems = null;
            }

            this.parseOptions(options);
            options = this.options;

            if ("richlistitems" in options)
            {
                richlistitems = options.richlistitems;
            }

            this.$element = $($.create(this.name, this.attributes).toString());
            this.element = this.$element.element();

            if (richlistitems && Array.isArray(richlistitems))
            {
                this.addListItems(richlistitems);
            }
            else if (richlistitems && ! Array.isArray(richlistitems))
            {
                log.warn("List items must be in an array.  Failed to add list "+
                         "items to listbox.");
            }
        };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / element.js View on Github external
var attributes = Object.assign(options.attributes || {}, this.attributes);
            
            if (typeof value == "object")
            {
                options = value;
                attributes = Object.assign(options.attributes || {}, this.attributes);
            }
            else
            {
                if (value)
                    attributes[attribute] = value;
            }
            
            this.options = options;
            this.attributes = attributes;
            this.$element = $($.create(this.name, attributes).toString());
            this.$element.addClass("ui-" + this.name);
            this.element = this.$element.element();
        };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / listbox.js View on Github external
{
            if ( ! Array.isArray(listitems) && typeof listitems == "object")
            {
                options = listitems;
                listitems = null;
            }
            
            this.parseOptions(options);
            options = this.options;

            if ("listitems" in options)
            {
                listitems = options.listitems;
            }
            
            this.$element = $($.create(this.name, this.attributes).toString());
            this.$element.addClass("ui-" + this.name);
            this.element = this.$element.element();
            
            if (listitems && Array.isArray(listitems))
            {
                this.addListItems(listitems);
            }
            else if (listitems && ! Array.isArray(listitems))
            {
                log.warn("List items must be in an array.  Failed to add list "+
                         "items to listbox.");
            }
            
            if ("listheaders" in options)
            {
                this.addListHeaders(options.listheaders);
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / radiogroup.js View on Github external
options = { options: options };
            }
            
            if (typeof label == "object")
            {
                options = label;
                label = null;
            }
            else if (label)
            {
                options.label = label;
            }
            
            this.options = options;
            this.attributes = attributes;
            this.$element = $($.create(this.name).toString());
            this.$element.addClass("ui-radiogroup-wrapper");
            this.element = this.$element.element();
            
            this.$formElement = $($.create("radiogroup", attributes).toString());
            this.$formElement.addClass("ui-radiogroup");
            this.formElement = this.$formElement.element();
            this.$element.append(this.formElement);
            
            if (options.label)
            {
                this.$element.prepend(require("./label").create(options.label).element);
            }
            var radioBtns = options.options;
            if (radioBtns && Array.isArray(radioBtns))
            {
                this.addRadioItems(radioBtns)
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / span.js View on Github external
this.init = function(value, options = {})
        {
            this.parseOptions(options);
            this.$element = $($.create(this.name, this.attributes).toString());
            this.$element.text(value);
            this.$element.addClass("ui-span");
            this.element = this.$element.element();
        };
github Komodo / KomodoEdit / src / chrome / komodo / content / sdk / ui / element.js View on Github external
if (label && typeof label == "object")
            {
                options = label;
                label = null;
            }
            
            var attributes = Object.assign(options.attributes || {}, this.attributes);
            
            if (typeof label == "string")
            {
                attributes.label = label;
            }
            
            this.options = options;
            this.attributes = attributes;
            this.$element = $($.create(this.name, attributes).toString());
            this.$element.addClass("ui-" + this.name);
            this.element = this.$element.element();
        };