diff --git a/_js/app.js b/_js/app.js index ce21b1b81..1099f465c 100644 --- a/_js/app.js +++ b/_js/app.js @@ -1,5 +1,4 @@ // 3rd party libs -window.jQuery = window.$ = require('jquery') window.Prism = require('prismjs') // All the others diff --git a/_js/behaviors/searchable-header.js b/_js/behaviors/searchable-header.js index b2880b61e..a9947944b 100644 --- a/_js/behaviors/searchable-header.js +++ b/_js/behaviors/searchable-header.js @@ -1,5 +1,6 @@ import onmount from 'onmount' -import $ from 'jquery' +import { nextUntil } from '../helpers/dom' +import matches from 'dom101/matches' // Ensure that search-index is set first import './searchable-item' @@ -9,16 +10,13 @@ import './searchable-item' */ onmount('[data-js-searchable-header]', function () { - const $this = $(this) - const $els = $this - .nextUntil('[data-js-searchable-header]') - .filter('[data-search-index]') + const els = nextUntil(this, '[data-js-searchable-header]') + .filter(el => matches(el, '[data-search-index]')) - const keywords = $els - .map(function () { return $(this).attr('data-search-index') }) - .get() + const keywords = els + .map(n => n.getAttribute('data-search-index')) .join(' ') .split(' ') - $this.attr('data-search-index', keywords.join(' ')) + this.setAttribute('data-search-index', keywords.join(' ')) }) diff --git a/_js/wrapify/dom_helpers.js b/_js/helpers/dom.js similarity index 100% rename from _js/wrapify/dom_helpers.js rename to _js/helpers/dom.js diff --git a/_js/wrapify/index.js b/_js/wrapify/index.js index f0be30497..e2b93f589 100644 --- a/_js/wrapify/index.js +++ b/_js/wrapify/index.js @@ -1,6 +1,6 @@ import matches from 'dom101/matches' import addClass from 'dom101/add-class' -import { appendMany, nextUntil, before, findChildren, createDiv } from './dom_helpers' +import { appendMany, nextUntil, before, findChildren, createDiv } from '../helpers/dom' /** * Wraps h2 sections into h2-section. diff --git a/assets/packed/app.js b/assets/packed/app.js index 0263503b3..a07c57da7 100644 --- a/assets/packed/app.js +++ b/assets/packed/app.js @@ -1,4 +1,4 @@ -webpackJsonp([0],{"/k7tj9kxRFhFtZjlt346":function(t,e,i){"use strict";function n(t,e){if(window.localStorage){var i=JSON.parse(window.localStorage[t]||"{}");i=e(i),window.localStorage[t]=JSON.stringify(i)}}function o(t){if(window.localStorage)return JSON.parse(window.localStorage[t]||"{}")}Object.defineProperty(e,"__esModule",{value:!0}),e.update=n,e.fetch=o},"/n6t+V4ehwYkVVtDRmGr":function(t,e,i){"use strict";function n(t){o((0,s.default)(t),{tag:"h2",wrapper:'