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

bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder #4707

Closed
gregallensworth opened this issue Dec 4, 2015 · 2 comments
Closed

Comments

@gregallensworth
Copy link

Type: bug

Platform: all

$ionicPopup.prompt() supports the inputPlaceholder option. This is not escaped, but used as-provided when passed to popup.js showPrompt()

Use of quotes will cause invalid HTML to be generated, causing at minimum the placeholder to be truncated, but potentially other strangeness, e.g. if the input contains a > character as well, it could terminate the tag and cause other misbehavior.

Example:

   $ionicPopup.prompt({
      title: 'Three Words Below?',
      inputPlaceholder: 'your "favorite" ><b>here',
   });

Implement check to escape these properly, since they are being placed inside an attribute.

@gregallensworth gregallensworth changed the title $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText Dec 4, 2015
@gregallensworth gregallensworth changed the title bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder Dec 4, 2015
@gregallensworth
Copy link
Author

Confirmed that defaultText option is not affected, since this uses ng-model and is subject to Angular's own escaping. Title updated.

@gregallensworth
Copy link
Author

Commit d3fad60 just follows this same pattern that was developing, of using Angular's own templating and binding instead of raw string interpolation. This should make $ionicPopup.prompt() more forgiving of certain types of input errors, and provide a clear copy-paste-easy method for adding new options in the future.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant