Really remove jQuery

This commit is contained in:
Rico Sta. Cruz 2017-10-13 17:35:40 +08:00
parent 0d4a43790a
commit abcc50a4ba
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
6 changed files with 39 additions and 42 deletions

View File

@ -1,5 +1,4 @@
// 3rd party libs
window.jQuery = window.$ = require('jquery')
window.Prism = require('prismjs')
// All the others

View File

@ -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(' '))
})

View File

@ -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.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long