Skip to content

tooltip source:auto cloned content causes issues with pat-inject #394

Open
@adrianwhite

Description

@adrianwhite
Member

This causes issues when pat-inject tries and update the tooltip content.
I'm not sure of the best way to create an example of this issue.

I have markup similar to:

<a href="#my-item-wrapper" class="pat-tooltip" data-pat-tooltip="source:auto">I have a tooltip</a>

<div id="my-item-wrapper" style="display:none;">
<div id="my-item">
    <form id="my-search-form"
           action="/url-to-search-results"
           class="pat-inject"
           data-pat-inject="target: #my-search-results; source: #search-results">
        <input name="" type="search" placeholder="Search" />
        <button type="submit">Search</button>
    </form>
    <div id="my-search-results">
        <!-- results go here -->
    </div>
</div>

pat-tooltip takes the content of div#my-item-wrapper and clones it into a tooltip.
The issue is that I end up with two copies of div#my-item and all contents including div#my-search-results. This means that pat-inject injects the results of the search into the first div#my-search-results it finds, which is the original one not the one in the tooltip.

Activity

fulv

fulv commented on Feb 8, 2015

@fulv
Contributor

Side-question: http://patternslib.com/demo/tooltip/index.html does not list source:auto as an available option. Out of date documentation?

fulv

fulv commented on Feb 8, 2015

@fulv
Contributor

Idea: how about using the class option in data-pat-tooltip?
e.g.: data-pat-tooltip:....; class: tooltipsearch

Then you might be able to say: data-pat-inject: .tooltipsearch #my-search-results;...?

Just a thought.

fulv

fulv commented on Feb 8, 2015

@fulv
Contributor

One more thought: I thought pat-inject was supposed to repeat the same source content or element as many times as there are matching target jquery selectors? Or is it a problem of multiple identical ids, which are supposed to be unique?

adrianwhite

adrianwhite commented on Feb 9, 2015

@adrianwhite
MemberAuthor

Side-question: http://patternslib.com/demo/tooltip/index.html does not list source:auto as an available option. Out of date documentation?

I wanted to find out the full behaviour of pat-tooltip, whilst reading the code I found the source:auto option.

Idea: how about using the class option in data-pat-tooltip?
e.g.: data-pat-tooltip:....; class: tooltipsearch

Then you might be able to say: data-pat-inject: .tooltipsearch #my-search-results;...?

Just a thought.

I'll take look at that.

One more thought: I thought pat-inject was supposed to repeat the same source content or element as many times as there are matching target jquery selectors? Or is it a problem of multiple identical ids, which are supposed to be unique?

Pat-tooltip copies the html rather than moving it so if you have ids you end up with duplicated ids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @fulv@adrianwhite

        Issue actions

          tooltip source:auto cloned content causes issues with pat-inject · Issue #394 · Patternslib/Patterns