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 // 3rd party libs
window.jQuery = window.$ = require('jquery')
window.Prism = require('prismjs') window.Prism = require('prismjs')
// All the others // All the others

View File

@ -1,5 +1,6 @@
import onmount from 'onmount' import onmount from 'onmount'
import $ from 'jquery' import { nextUntil } from '../helpers/dom'
import matches from 'dom101/matches'
// Ensure that search-index is set first // Ensure that search-index is set first
import './searchable-item' import './searchable-item'
@ -9,16 +10,13 @@ import './searchable-item'
*/ */
onmount('[data-js-searchable-header]', function () { onmount('[data-js-searchable-header]', function () {
const $this = $(this) const els = nextUntil(this, '[data-js-searchable-header]')
const $els = $this .filter(el => matches(el, '[data-search-index]'))
.nextUntil('[data-js-searchable-header]')
.filter('[data-search-index]')
const keywords = $els const keywords = els
.map(function () { return $(this).attr('data-search-index') }) .map(n => n.getAttribute('data-search-index'))
.get()
.join(' ') .join(' ')
.split(' ') .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 matches from 'dom101/matches'
import addClass from 'dom101/add-class' 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. * 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