Sha256: bdabfa3565fde5d8f89107e8e1324c816a2a3274118137120fb823bd271b383a

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

include('../view.js');

uki.view.declare('uki.more.view.NativeControl', uki.view.Base, uki.view.Focusable, function(Base, Focusable) {
    this._setup = function() {
        Base._setup.call(this);
        this._type = 'button';
    };
    
    uki.delegateProp(this, 'disabled', '_dom');
    uki.delegateProp(this, 'value', '_dom');
    
    this.domName = function(name) {
        if (name === undefined) return this._dom.name;
        this._dom.setAttribute('name', name);
        this._dom.name = name;
        this._initClassName();
        
        if (/MSIE 6/.test(navigator.userAgent)) {
            var clone = document.createElement('<input name="' + name + '" />');
            clone.type = this._type; // type is not copied
            clone.mergeAttributes(this._dom);
            if (this._dom.parentNode) {
                this._dom.parentNode.replaceChild(clone, this._dom);
            }
            this._dom = clone;
        }
        
        return this;
    };
    
    this._createDom = function() {
        this._dom = uki.createElement('input', 'position:absolute;z-index:100;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;');
        this._dom.type = this._type;
        this._initFocusable(this._dom);
    };
    
    this._bindToDom = function(name) {
        return Focusable._bindToDom.call(this, name) || Base._bindToDom.call(this, name);
    };
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uki-1.1.4 frameworks/uki/src/uki-more/more/view/nativeControl.js
uki-1.1.3 frameworks/uki/src/uki-more/more/view/nativeControl.js
uki-1.1.2 frameworks/uki/src/uki-more/more/view/nativeControl.js