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

Strange JS-code fragment in href attribute value in result list #190

Closed
ivan-ilinov opened this Issue Apr 26, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@ivan-ilinov

ivan-ilinov commented Apr 26, 2016

My settings:

{ dynamic: true, display: 'suggestion', source: { suggestion: { ajax: { url: Drupal.settings.basePath + 'prlib_sf/suggestions?code=' + value.prlib_data.code + '&key={{query}}', } } } }

I use last 2.6.0 version in master branch.

In result list i get JS fragment like this:
<li class="typeahead__item"><a href="function () {&#10; if (_href) {&#10; if (typeof _href === &quot;string&quot;) {&#10; _href = _href.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi, function (match, index, options) {&#10;&#10; var value = scope.helper.namespace(index, _item, 'get', '');&#10;&#10; // #151 Slugify should be an option, not enforced&#10; options = options &amp;&amp; options.split(&quot;|&quot;) || [];&#10; if (~options.indexOf('slugify')) {&#10; value = scope.helper.slugify.call(scope, value);&#10; }&#10;&#10; return value;&#10; });&#10; } else if (typeof _href === &quot;function&quot;) {&#10; _href = _href(_item);&#10; }&#10; _item.href = _href;&#10; }&#10; return _href || &quot;javascript:;&quot;;&#10; }" data-group="suggestion" data-index="1"><span class="typeahead__display"><strong>Иван</strong>ов Н.И. Николай <strong>Иван</strong>ович</span></a></li>

Or (in minified version):
<li class="typeahead__item"><a href="function (){return h&amp;&amp;(&quot;string&quot;==typeof h?h=h.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var n=o.helper.namespace(e,l,&quot;get&quot;,&quot;&quot;);return i=i&amp;&amp;i.split(&quot;|&quot;)||[],~i.indexOf(&quot;slugify&quot;)&amp;&amp;(n=o.helper.slugify.call(o,n)),n}):&quot;function&quot;==typeof h&amp;&amp;(h=h(l)),l.href=h),h||&quot;javascript:;&quot;}" data-group="suggestion" data-index="2"><span class="typeahead__display">Кондря Т. И. Татьяна <strong>Иван</strong>овна</span></a></li>

@ivan-ilinov

This comment has been minimized.

ivan-ilinov commented Apr 27, 2016

I have this problem in jQuery ver. 1.8.3
In ver. 1.10.2 all works fine.

@kavin-90

This comment has been minimized.

kavin-90 commented Apr 27, 2016

Everything is okay with using Jquery 2.2.3

@running-coder

This comment has been minimized.

Owner

running-coder commented May 2, 2016

Hey Ivan, the Typeahead is supposed to support jQuery 1.7.2+, I'll double-check on this issue. Thanks

@running-coder running-coder reopened this May 2, 2016

running-coder added a commit that referenced this issue May 2, 2016

@running-coder

This comment has been minimized.

Owner

running-coder commented May 2, 2016

Should be good now, thanks for reporting!

@running-coder running-coder added the Bug label May 2, 2016

@running-coder running-coder added this to the 2.6.1 milestone May 2, 2016

running-coder added a commit that referenced this issue May 3, 2016

Version 2.6.1
Fixes
- #189 Twice url encoding
- #190 Strange JS-code fragment in href attribute value in result list when using jQuery version below 1.10
- #192 Results remain open when clicking inside a second typeahead field
- #193 Clicking on a suggested option does not select it on IE11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment