<commit_before>package priori.view.form;

import priori.event.PriEvent;
import jQuery.Event;
class PriFormCheckBox extends PriFormElementBase {

    @:isVar public var value(get, set):Bool;

    public function new() {
        super();

        this.value = false;
    }

    override private function getComponentCode():String {
        return "<input type=\"checkbox\" style=\"padding:0px;margin:0px;\" />";
    }

    override private function onAddedToApp():Void {
        this._baseElement.on("change", this._onCheckChange);
    }

    override private function onRemovedFromApp():Void {
        this._baseElement.off("change", this._onCheckChange);
    }

    @:noCompletion private function _onCheckChange(event:Event):Void {
        this.dispatchEvent(new PriEvent(PriEvent.CHANGE));
    }

    @:noCompletion private function set_value(value:Bool):Bool {
        this.value = value;

        this._baseElement.prop("checked", value);

        return value;
    }

    @noCompletion private function get_value():Bool {
        var result:Bool = this.value;

        var isDisabled:Bool = this.disabled;
        if (isDisabled) this.disabled = false;

        result = this._baseElement.prop("checked");

        if (isDisabled) this.disabled = true;

        return result;
    }
}<commit_msg>bugfix : get value on disabled checkboxes<commit_after>package priori.view.form;

import priori.event.PriEvent;
import jQuery.Event;
class PriFormCheckBox extends PriFormElementBase {

    @:isVar public var value(get, set):Bool;

    public function new() {
        super();

        this.value = false;
    }

    override private function getComponentCode():String {
        return "<input type=\"checkbox\" style=\"padding:0px;margin:0px;\" />";
    }

    override private function onAddedToApp():Void {
        this._baseElement.on("change", this._onCheckChange);
    }

    override private function onRemovedFromApp():Void {
        this._baseElement.off("change", this._onCheckChange);
    }

    @:noCompletion private function _onCheckChange(event:Event):Void {
        this.dispatchEvent(new PriEvent(PriEvent.CHANGE));
    }

    @:noCompletion private function set_value(value:Bool):Bool {
        this.value = value;

        this._baseElement.prop("checked", value);

        return value;
    }

    @noCompletion private function get_value():Bool {
        var result:Bool = this.value;

        var isDisabled:Bool = this._baseElement.is("[disabled]");

        if (isDisabled) this._baseElement.removeAttr("disabled");

        result = this._baseElement.prop("checked");

        if (isDisabled) this._baseElement.attr("disabled", "disabled");

        return result;
    }
}
{'fraction_non_alphanumeric': 0.11902113459399333, 'fraction_numerical': 0.0014831294030404152, 'mean_word_length': 3.087878787878788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2959047', 'n_tokens_mistral': 772, 'n_tokens_neox': 744, 'n_words': 162}