Initial switch from jq.data to pure props.
This commit is contained in:
parent
06b4d81a61
commit
a3c9bc9db0
3 changed files with 9 additions and 11 deletions
|
@ -21,7 +21,7 @@ let $crumbbar;
|
|||
|
||||
function createHtml(item) {
|
||||
const $html = jq(crumbTemplate).data('item', item);
|
||||
item.$crumb = $html;
|
||||
item.elCrumb = $html[0];
|
||||
location.setLink($html, item);
|
||||
|
||||
$html.find('.label').text(item.label);
|
||||
|
@ -38,7 +38,7 @@ function createHtml(item) {
|
|||
}
|
||||
|
||||
function onLocationChanged(item) {
|
||||
const $crumb = item.$crumb;
|
||||
const $crumb = jq(item.elCrumb);
|
||||
|
||||
if ($crumb && $crumb.parent()[0] === $crumbbar[0]) {
|
||||
$crumbbar.children().removeClass('active');
|
||||
|
|
|
@ -108,10 +108,10 @@ function update(item) {
|
|||
}
|
||||
}
|
||||
|
||||
if (item.$tree) {
|
||||
item.$tree.replaceWith($html);
|
||||
if (item.elTree) {
|
||||
jq(item.elTree).replaceWith($html);
|
||||
}
|
||||
item.$tree = $html;
|
||||
item.elTree = $html[0];
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ const settings = Object.assign({
|
|||
const sortedSizes = settings.sizes.sort((a, b) => a - b);
|
||||
const checkedModes = intersection(settings.modes, modes);
|
||||
const storekey = 'view';
|
||||
const elKey = '_h5ai_item';
|
||||
const tplView =
|
||||
`<div id="view">
|
||||
<ul id="items" class="clearfix">
|
||||
|
@ -131,8 +130,7 @@ const createHtml = item => {
|
|||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
.data('item', item);
|
||||
|
||||
$html[0][elKey] = item;
|
||||
$html[0]._item = item;
|
||||
|
||||
location.setLink($a, item);
|
||||
|
||||
|
@ -162,12 +160,12 @@ const createHtml = item => {
|
|||
};
|
||||
|
||||
const onMouseenter = ev => {
|
||||
const item = jq(ev.currentTarget).closest('.item').data('item');
|
||||
const item = jq(ev.currentTarget).closest('.item')[0]._item;
|
||||
event.pub('item.mouseenter', item);
|
||||
};
|
||||
|
||||
const onMouseleave = ev => {
|
||||
const item = jq(ev.currentTarget).closest('.item').data('item');
|
||||
const item = jq(ev.currentTarget).closest('.item')[0]._item;
|
||||
event.pub('item.mouseleave', item);
|
||||
};
|
||||
|
||||
|
@ -182,7 +180,7 @@ const checkHint = () => {
|
|||
};
|
||||
|
||||
const setItems = items => {
|
||||
const removed = map($items.find('.item'), el => jq(el).data('item'));
|
||||
const removed = map($items.find('.item'), el => el._item);
|
||||
|
||||
$items.find('.item').remove();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue