Skip to content

Error: cannot call methods on button prior to initialization; attempted to call method 'refresh' if showNoneButton=false or alpha=false #182

@rudolphi

Description

@rudolphi

Cancel button not working, maybe also other problems.

Tested qith jQueryUI 1.14.1, problem is lines 1690/91:
this.repaint = function () {
$('.ui-colorpicker-special-none', part).prop('checked', !inst.color.set).button('refresh');
$('.ui-colorpicker-special-transparent', part).prop('checked', inst.color.set && inst.color.getAlpha() === 0).button('refresh');
$('.ui-colorpicker-ok', part).button(inst.changed ? 'enable' : 'disable');
};
At least one of the jQuery sets is empty if the resp. options are false, causing the jQueryUI error.

Fixed by adding ":ui-button" to the selectors:
this.repaint = function () {
$('.ui-colorpicker-special-none:ui-button', part).prop('checked', !inst.color.set).button('refresh');
$('.ui-colorpicker-special-transparent:ui-button', part).prop('checked', inst.color.set && inst.color.getAlpha() === 0).button('refresh');
$('.ui-colorpicker-ok', part).button(inst.changed ? 'enable' : 'disable');
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions