tooltip source:auto cloned content causes issues with pat-inject
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.
Side-question: http://patternslib.com/demo/tooltip/index.html does not list source:auto as an available option. Out of date documentation?
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.
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?
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.