Skip to content

Commit aef842d

Browse files
authored
Merge pull request #362 from canjs/travis-firefox
Fix results for “define/map” in recent version of Firefox
2 parents 40a4edc + 1f52dfd commit aef842d

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ language: node_js
22
node_js: node
33
before_install:
44
- "export DISPLAY=:99.0"
5-
- "sh -e /etc/init.d/xvfb start"
5+
- "sh -e /etc/init.d/xvfb start"
6+
addons:
7+
firefox: "51.0"

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# bit-docs-html-canjs
2+
3+
[![Build Status](https://travis-ci.org/canjs/bit-docs-html-canjs.svg?branch=master)](https://travis-ci.org/canjs/bit-docs-html-canjs)
4+
[![npm version](https://badge.fury.io/js/bit-docs-html-canjs.svg)](https://www.npmjs.com/package/bit-docs-html-canjs)
5+
16
## Initial install:
27

38
```

static/search.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,20 +363,22 @@ var Search = Control.extend({
363363
if (searchTerm.indexOf('can-') > -1) {// If the search term includes “can-”
364364

365365
// look for an exact match and apply a large positive boost
366-
q.term(searchTerm, { usePipeline: true, boost: 375 });
366+
q.term(searchTerm, { boost: 375 });
367367

368368
} else {
369369
// add “can-”, look for an exact match in the title field, and apply a positive boost
370-
q.term('can-' + searchTerm, { usePipeline: false, boost: 12 });
370+
q.term('can-' + searchTerm, { boost: 12 });
371371

372372
// look for terms that match the beginning or end of this query
373-
q.term(searchTerm, { usePipeline: false, wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
373+
// look in the title field specifically to boost matches in it
374+
q.term(searchTerm, { fields: ['title'], wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
375+
q.term(searchTerm, { wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING });
374376
}
375377

376378
// look for matches in any of the fields and apply a medium positive boost
377379
var split = searchTerm.split(lunr.tokenizer.separator);
378380
split.forEach(function(term) {
379-
q.term(term, { usePipeline: false, fields: q.allFields, boost: 10 });
381+
q.term(term, { boost: 10, fields: q.allFields });
380382
});
381383
});
382384

@@ -717,14 +719,14 @@ var Search = Control.extend({
717719

718720
resetScrollToTop: function(activeResultPosTop){
719721
this.$resultsContainer.scrollTop(
720-
this.$resultsContainer.scrollTop() +
722+
this.$resultsContainer.scrollTop() +
721723
activeResultPosTop
722724
);
723725
},
724726

725727
resetScrollToBottom: function(activeResultPosTop, resultsContainerHeight){
726728
// Calculate active result's position bottom
727-
var scrollTo = (activeResultPosTop + this.$activeResult.outerHeight()) -
729+
var scrollTo = (activeResultPosTop + this.$activeResult.outerHeight()) -
728730
// Calculate the current scrolled position of the bottom of the list
729731
(this.getActiveResultOffset() + resultsContainerHeight);
730732

0 commit comments

Comments
 (0)