
var rcheck = /checked|radio/
var describe = {
    set: function(value) {
        var controllProp = rcheck.test(this.type) ? "checked" ? "value"
        if (this.type === "textarea") {
            this.innerHTML = value;
        }
        if (!this._observing) {
            if (!this._setValue) {
                //注意defaultValue只会同步一次value
                var parsedValue = (this[controllProp] = value);
                this._persistValue = Array.isArray(value) ? value : parsedValue;
                this._setValue = true;
            }
        } else {
            //如果用户私下改变defaultValue，那么_setValue会被抺掉
            this._setValue = value == null ? false : true;
        }
        this._defaultValue = value;
    },
    get: function() {
        return this._defaultValue;
    },
    configurable: true
}

uncontrolledImpl.observe = function(dom, name) {
    try {
        if("_persistValue" in dom){
            dom._setValue = true;
        }
        var controllProp = name === "defaultValue" ? "value" : "checked";
        Object.defineProperty(dom, name, {
            set: function(value) {
                if (dom.type === "textarea") {
                    dom.innerHTML = value;
                }
                if (!dom._observing) {
                    if (!dom._setValue) {
                        //注意defaultValue只会同步一次value
                        var parsedValue = (dom[controllProp] = value);
                        dom._persistValue = Array.isArray(value) ? value : parsedValue;
                        dom._setValue = true;
                    }
                } else {
                    //如果用户私下改变defaultValue，那么_setValue会被抺掉
                    dom._setValue = value == null ? false : true;
                }
                dom._defaultValue = value;
            },
            get: function() {
                return dom._defaultValue;
            },
            configurable: true
        });
    } catch (e) {}
};