Skip to content

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

Closed

Description

@gregallensworth

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.

Activity

  1. changed the title [-]$ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText[/-] [+]bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText[/+] on Dec 4, 2015
  2. changed the title [-]bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder or defaultText[/-] [+]bug: $ionicPopup.prompt() broken if "quotes" used in inputPlaceholder[/+] on Dec 4, 2015
  3. gregallensworth commented on Dec 4, 2015

    @gregallensworth
    Author

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

  4. gregallensworth commented on Dec 4, 2015

    @gregallensworth
    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.

  5. locked and limited conversation to collaborators on Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions