Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Error thrown when activeBtnClass is set to an empty string #4811

Closed
@tomvanenckevort

Description

@tomvanenckevort

When overriding the activeBtnClass default setting with an empty string (if you wanted to have no special highlight class for active buttons), it throws an unhandled exception when closing dialogs.

So when you're initially loading jQuery Mobile, you override the activeBtnClass like this:

$.mobile.activeBtnClass = "";

When you then have a page that opens a dialog, clicking the close button of the dialog throws the following error:
Uncaught Error: Syntax error, unrecognized expression: .

It turns out that when executing the pagehide event handler it executes the following code (line 4158 in jQM1.1.1):

.bind( "pagehide", function( e, ui ) {
            self._isClosed = false;
            $( this ).find( "." + $.mobile.activeBtnClass )
                                     .not( ".ui-slider-bg" )
                                     .removeClass( $.mobile.activeBtnClass );
        })

Because activeBtnClass is an empty string, it tries to execute find(".") which is not allowed in jQuery, hence the exception.

To solve this there either needs to be a check whether activeBtnClass is empty before executing this code, or the documentation should specify that activeBtnClass cannot be an empty string.

As a workaround for now, if you wanted to have no active button state class, you could set activeBtnClass to a non-existent CSS class name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions