More jQuery to native (including bootstrap.js)

This commit is contained in:
djmaze 2020-08-30 10:30:50 +02:00
parent bdb36ec128
commit 69fcc240e9
39 changed files with 496 additions and 344 deletions

View file

@ -265,26 +265,23 @@ class Selector {
this.oContentScrollable = contentScrollable;
if (contentScrollable) {
jQuery(contentScrollable)
.on('selectstart', (event) => {
if (event && event.preventDefault) {
event.preventDefault();
}
})
.on('click', this.sItemSelector, (event) => {
this.actionClick(ko.dataFor(event.currentTarget), event);
})
.on('click', this.sItemCheckedSelector, (event) => {
const item = ko.dataFor(event.currentTarget);
contentScrollable.addEventListener('click', event => {
let el = event.target.closestWithin(this.sItemSelector, contentScrollable);
el && this.actionClick(ko.dataFor(el), event);
el = event.target.closestWithin(this.sItemCheckedSelector, contentScrollable);
if (el) {
const item = ko.dataFor(el);
if (item) {
if (event && event.shiftKey) {
if (event.shiftKey) {
this.actionClick(item, event);
} else {
this.focusedItem(item);
item.checked(!item.checked());
}
}
});
}
});
key('enter', keyScope, () => {
const focused = this.focusedItem();

View file

@ -14,13 +14,6 @@ const
},
htmlspecialchars = str => (''+str).replace(/[&<>"']/g, m => htmlmap[m]);
export function htmlToElement(html) {
var template = document.createElement('template');
template.innerHTML = html.trim();
return template.content.firstChild;
}
/**
* @param {(string|number)} value
* @param {boolean=} includeZero = true