Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buttons with HTML characters not created correctly #66

Open
ajwaddell opened this issue Jul 22, 2015 · 3 comments
Open

Buttons with HTML characters not created correctly #66

ajwaddell opened this issue Jul 22, 2015 · 3 comments

Comments

@ajwaddell
Copy link

The issue I am having is when a HTML character is within the button text the button is not created correctly because the button tag is closed prematurely.

I have created a jsFiddle to recreate the issue. http://jsfiddle.net/ajw89/byoasc15/3/

I have also tried running htmlentities() prior to passing the text into impromptu. This fixes the display issue, but the button click is not recognised. This is because the impromptu internal button object looks like the image below and when it is comparing the button.text() value "B<C" it doesn't match, so it won't know the button was clicked.

image

Is this a bug or is there a way to get around this issue?

@trentrichardson
Copy link
Owner

@ajwaddell Sorry for the delay, this slipped through the inbox. You can pass an array of objects also like so:

$.prompt('hello world', {
    buttons: [
        { title: 'text', value: 123 },
        { title: 'text', value: 456 }
    ]
});

@ajwaddell
Copy link
Author

I have tried passing an array of objects like you said. It fixes the '<' issue I was having. Unfortunately if the button text contains a single quote. The button clicked is set to 'undefined'.

I have updated the jsFiddle to demonstrate this. http://jsfiddle.net/ajw89/6vbenuwm/1/

@trentrichardson
Copy link
Owner

Thanks for creating the jsfiddle, that helps me see the issue directly. It does seem to be a bug. I will try to take a look into resolving it. I will say however that you can swap that ' with an actual ' and seems to work, although I don't have all browsers available to test on at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants