Skip to content

Tooltip can't find elements with Invalid Selectors as IDs #303

@explorigin

Description

@explorigin

Describe the Bug

Tooltip fails whenever the target id makes an invalid CSS selector.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a trigger element like so:
<span data-tooltip="2d90208e58f24216be64de517570c628">Hello</span>
<hx-tooltip id="2d90208e58f24216be64de517570c628">Do you like my hat?</hx-tooltip>
  1. Hover over Hello with your mouse.
  2. Observe error (screenshotted below) in the dev console.

Expected behavior

I expected it to ask me about my hat.

Screenshots

image

Environment

Please complete the following information:

  • Device: Lappy
  • OS: OSX
  • Browser: Chrome 68

Additional Context

Problem is here. Make it look like:

this._target = this.getRootNode().querySelector('[data-tooltip="' + this.id + '"]');

Proof that the fix works:
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions