uikit 3.11.2-dev.21a5b7139 → 3.11.2-dev.2b60845fb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +3 -3
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +5 -7
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +6 -6
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +8 -8
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +1 -1
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +16 -17
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +6 -6
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +12 -14
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +1 -1
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +10 -14
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +77 -90
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +112 -130
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/state.js +2 -2
- package/src/js/components/countdown.js +2 -2
- package/src/js/components/internal/slider-transitioner.js +2 -2
- package/src/js/components/lightbox.js +2 -2
- package/src/js/components/slider.js +9 -10
- package/src/js/components/sortable.js +7 -7
- package/src/js/components/upload.js +9 -13
- package/src/js/core/accordion.js +3 -3
- package/src/js/core/height-match.js +3 -3
- package/src/js/core/img.js +3 -1
- package/src/js/core/margin.js +11 -13
- package/src/js/core/navbar.js +2 -2
- package/src/js/core/scrollspy.js +6 -6
- package/src/js/core/toggle.js +2 -2
- package/src/js/mixin/slider-drag.js +3 -3
- package/src/js/mixin/slider-nav.js +2 -2
- package/src/js/util/attr.js +14 -12
- package/src/js/util/dom.js +5 -20
- package/src/js/util/position.js +2 -2
- package/src/js/util/promise.js +0 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.11.2-dev.
|
|
5
|
+
"version": "3.11.2-dev.2b60845fb",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
package/src/js/api/state.js
CHANGED
|
@@ -91,7 +91,7 @@ export default function (UIkit) {
|
|
|
91
91
|
|
|
92
92
|
UIkit.prototype._initEvents = function () {
|
|
93
93
|
this._events = [];
|
|
94
|
-
this.$options.events
|
|
94
|
+
for (const event of this.$options.events || []) {
|
|
95
95
|
if (hasOwn(event, 'handler')) {
|
|
96
96
|
registerEvent(this, event);
|
|
97
97
|
} else {
|
|
@@ -99,7 +99,7 @@ export default function (UIkit) {
|
|
|
99
99
|
registerEvent(this, event[key], key);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
UIkit.prototype._unbindEvents = function () {
|
|
@@ -77,7 +77,7 @@ export default {
|
|
|
77
77
|
timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
this.units
|
|
80
|
+
for (const unit of this.units) {
|
|
81
81
|
let digits = String(Math.floor(timespan[unit]));
|
|
82
82
|
|
|
83
83
|
digits = digits.length < 2 ? `0${digits}` : digits;
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
|
|
93
93
|
digits.forEach((digit, i) => (el.children[i].textContent = digit));
|
|
94
94
|
}
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
98
|
|
|
@@ -89,7 +89,7 @@ export default function (prev, next, dir, { center, easing, list }) {
|
|
|
89
89
|
|
|
90
90
|
percent = prev ? clamp(percent, -1, 1) : 0;
|
|
91
91
|
|
|
92
|
-
children(list)
|
|
92
|
+
for (const slide of children(list)) {
|
|
93
93
|
const isActive = includes(actives, slide);
|
|
94
94
|
const isIn = slide === itemIn;
|
|
95
95
|
const isOut = slide === itemOut;
|
|
@@ -104,7 +104,7 @@ export default function (prev, next, dir, { center, easing, list }) {
|
|
|
104
104
|
dir,
|
|
105
105
|
percent: isOut ? 1 - percent : isIn ? percent : isActive ? 1 : 0,
|
|
106
106
|
});
|
|
107
|
-
}
|
|
107
|
+
}
|
|
108
108
|
},
|
|
109
109
|
|
|
110
110
|
percent() {
|
|
@@ -73,9 +73,9 @@ function install(UIkit, Lightbox) {
|
|
|
73
73
|
function toItem(el) {
|
|
74
74
|
const item = {};
|
|
75
75
|
|
|
76
|
-
['href', 'caption', 'type', 'poster', 'alt', 'attrs']
|
|
76
|
+
for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
|
|
77
77
|
item[attr === 'href' ? 'source' : attr] = data(el, attr);
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
79
|
|
|
80
80
|
item.attrs = parseOptions(item.attrs);
|
|
81
81
|
|
|
@@ -130,7 +130,7 @@ export default {
|
|
|
130
130
|
|
|
131
131
|
update: {
|
|
132
132
|
write() {
|
|
133
|
-
this.navItems
|
|
133
|
+
for (const el of this.navItems) {
|
|
134
134
|
const index = toNumber(data(el, this.attrItem));
|
|
135
135
|
if (index !== false) {
|
|
136
136
|
el.hidden =
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
138
138
|
index > this.maxIndex ||
|
|
139
139
|
(this.sets && !includes(this.sets, index));
|
|
140
140
|
}
|
|
141
|
-
}
|
|
141
|
+
}
|
|
142
142
|
|
|
143
143
|
if (this.length && !this.dragging && !this.stack.length) {
|
|
144
144
|
this.reorder();
|
|
@@ -146,14 +146,13 @@ export default {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
const actives = this._getTransitioner(this.index).getActives();
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
);
|
|
149
|
+
const activeClasses = [
|
|
150
|
+
this.clsActive,
|
|
151
|
+
((!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated) ||
|
|
152
|
+
'',
|
|
153
|
+
];
|
|
154
|
+
for (const slide of this.slides) {
|
|
155
|
+
toggleClass(slide, activeClasses, includes(actives, slide));
|
|
157
156
|
}
|
|
158
157
|
},
|
|
159
158
|
|
|
@@ -67,13 +67,13 @@ export default {
|
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
created() {
|
|
70
|
-
['init', 'start', 'move', 'end']
|
|
70
|
+
for (const key of ['init', 'start', 'move', 'end']) {
|
|
71
71
|
const fn = this[key];
|
|
72
72
|
this[key] = (e) => {
|
|
73
73
|
assign(this.pos, getEventPos(e));
|
|
74
74
|
fn(e);
|
|
75
75
|
};
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
events: {
|
|
@@ -269,11 +269,11 @@ export default {
|
|
|
269
269
|
remove(this.drag);
|
|
270
270
|
this.drag = null;
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
this.touched
|
|
274
|
-
removeClass(sortable.items, clsPlaceholder, clsItem)
|
|
275
|
-
|
|
276
|
-
|
|
272
|
+
for (const { clsPlaceholder, clsItem } of this.touched) {
|
|
273
|
+
for (const sortable of this.touched) {
|
|
274
|
+
removeClass(sortable.items, clsPlaceholder, clsItem);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
277
|
this.touched = null;
|
|
278
278
|
removeClass(document.documentElement, this.clsDragState);
|
|
279
279
|
},
|
|
@@ -98,25 +98,25 @@ export default {
|
|
|
98
98
|
|
|
99
99
|
trigger(this.$el, 'upload', [files]);
|
|
100
100
|
|
|
101
|
-
for (
|
|
102
|
-
if (this.maxSize && this.maxSize * 1000 <
|
|
101
|
+
for (const file of files) {
|
|
102
|
+
if (this.maxSize && this.maxSize * 1000 < file.size) {
|
|
103
103
|
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
if (this.allow && !match(this.allow,
|
|
107
|
+
if (this.allow && !match(this.allow, file.name)) {
|
|
108
108
|
this.fail(this.msgInvalidName.replace('%s', this.allow));
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
if (this.mime && !match(this.mime,
|
|
112
|
+
if (this.mime && !match(this.mime, file.type)) {
|
|
113
113
|
this.fail(this.msgInvalidMime.replace('%s', this.mime));
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
if (!this.multiple) {
|
|
119
|
-
files =
|
|
119
|
+
files = files.slice(0, 1);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
this.beforeAll(this, files);
|
|
@@ -139,9 +139,9 @@ export default {
|
|
|
139
139
|
beforeSend: (env) => {
|
|
140
140
|
const { xhr } = env;
|
|
141
141
|
xhr.upload && on(xhr.upload, 'progress', this.progress);
|
|
142
|
-
['loadStart', 'load', 'loadEnd', 'abort']
|
|
143
|
-
on(xhr, type.toLowerCase(), this[type])
|
|
144
|
-
|
|
142
|
+
for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
|
|
143
|
+
on(xhr, type.toLowerCase(), this[type]);
|
|
144
|
+
}
|
|
145
145
|
|
|
146
146
|
return this.beforeSend(env);
|
|
147
147
|
},
|
|
@@ -180,11 +180,7 @@ function match(pattern, path) {
|
|
|
180
180
|
function chunk(files, size) {
|
|
181
181
|
const chunks = [];
|
|
182
182
|
for (let i = 0; i < files.length; i += size) {
|
|
183
|
-
|
|
184
|
-
for (let j = 0; j < size; j++) {
|
|
185
|
-
chunk.push(files[i + j]);
|
|
186
|
-
}
|
|
187
|
-
chunks.push(chunk);
|
|
183
|
+
chunks.push(files.slice(i, i + size));
|
|
188
184
|
}
|
|
189
185
|
return chunks;
|
|
190
186
|
}
|
package/src/js/core/accordion.js
CHANGED
|
@@ -105,7 +105,7 @@ export default {
|
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
for (const el of items) {
|
|
109
109
|
this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
|
|
110
110
|
toggleClass(el, this.clsOpen, show);
|
|
111
111
|
attr($(this.$props.toggle, el), 'aria-expanded', show);
|
|
@@ -134,8 +134,8 @@ export default {
|
|
|
134
134
|
scrollIntoView(toggle, { offset: this.offset });
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
})
|
|
138
|
-
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
139
|
},
|
|
140
140
|
},
|
|
141
141
|
};
|
|
@@ -29,9 +29,9 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
write({ rows }) {
|
|
32
|
-
|
|
33
|
-
elements.forEach((el, i) => css(el, 'minHeight', heights[i]))
|
|
34
|
-
|
|
32
|
+
for (const { heights, elements } of rows) {
|
|
33
|
+
elements.forEach((el, i) => css(el, 'minHeight', heights[i]));
|
|
34
|
+
}
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
events: ['resize'],
|
package/src/js/core/img.js
CHANGED
package/src/js/core/margin.js
CHANGED
|
@@ -22,10 +22,10 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
write({ columns, rows }) {
|
|
25
|
-
for (
|
|
26
|
-
for (
|
|
27
|
-
toggleClass(
|
|
28
|
-
toggleClass(
|
|
25
|
+
for (const row of rows) {
|
|
26
|
+
for (const column of row) {
|
|
27
|
+
toggleClass(column, this.margin, rows[0] !== row);
|
|
28
|
+
toggleClass(column, this.firstColumn, !!~columns[0].indexOf(column));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
},
|
|
@@ -41,10 +41,10 @@ export function getRows(items) {
|
|
|
41
41
|
function getColumns(rows) {
|
|
42
42
|
const columns = [];
|
|
43
43
|
|
|
44
|
-
for (
|
|
45
|
-
const sorted = sortBy(
|
|
44
|
+
for (const row of rows) {
|
|
45
|
+
const sorted = sortBy(row, 'left', 'right');
|
|
46
46
|
for (let j = 0; j < sorted.length; j++) {
|
|
47
|
-
columns[j] =
|
|
47
|
+
columns[j] = columns[j] ? columns[j].concat(sorted[j]) : sorted[j];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -54,17 +54,15 @@ function getColumns(rows) {
|
|
|
54
54
|
function sortBy(items, startProp, endProp) {
|
|
55
55
|
const sorted = [[]];
|
|
56
56
|
|
|
57
|
-
for (
|
|
58
|
-
const el = items[i];
|
|
59
|
-
|
|
57
|
+
for (const el of items) {
|
|
60
58
|
if (!isVisible(el)) {
|
|
61
59
|
continue;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
62
|
let dim = getOffset(el);
|
|
65
63
|
|
|
66
|
-
for (let
|
|
67
|
-
const current = sorted[
|
|
64
|
+
for (let i = sorted.length - 1; i >= 0; i--) {
|
|
65
|
+
const current = sorted[i];
|
|
68
66
|
|
|
69
67
|
if (!current[0]) {
|
|
70
68
|
current.push(el);
|
|
@@ -89,7 +87,7 @@ function sortBy(items, startProp, endProp) {
|
|
|
89
87
|
break;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
if (
|
|
90
|
+
if (i === 0) {
|
|
93
91
|
sorted.unshift([el]);
|
|
94
92
|
break;
|
|
95
93
|
}
|
package/src/js/core/navbar.js
CHANGED
|
@@ -111,12 +111,12 @@ export default {
|
|
|
111
111
|
const dropdowns = $$(`.${clsDrop}`, $el);
|
|
112
112
|
|
|
113
113
|
if (this.dropContainer !== $el) {
|
|
114
|
-
$$(`.${clsDrop}`, this.dropContainer)
|
|
114
|
+
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
|
|
115
115
|
const target = this.getDropdown(el)?.target;
|
|
116
116
|
if (!includes(dropdowns, el) && target && within(target, this.$el)) {
|
|
117
117
|
dropdowns.push(el);
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
return dropdowns;
|
package/src/js/core/scrollspy.js
CHANGED
|
@@ -53,10 +53,10 @@ export default {
|
|
|
53
53
|
},
|
|
54
54
|
|
|
55
55
|
disconnected() {
|
|
56
|
-
this.elements
|
|
56
|
+
for (const el of this.elements) {
|
|
57
57
|
removeClass(el, this.inViewClass, el[stateKey] ? el[stateKey].cls : '');
|
|
58
58
|
delete el[stateKey];
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
},
|
|
61
61
|
|
|
62
62
|
update: [
|
|
@@ -71,17 +71,17 @@ export default {
|
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
this.elements
|
|
74
|
+
for (const el of this.elements) {
|
|
75
75
|
if (!el[stateKey]) {
|
|
76
76
|
el[stateKey] = { cls: getData(el, 'uk-scrollspy-class') || this.cls };
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
|
|
80
|
-
}
|
|
80
|
+
}
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
write(data) {
|
|
84
|
-
this.elements
|
|
84
|
+
for (const el of this.elements) {
|
|
85
85
|
const state = el[stateKey];
|
|
86
86
|
|
|
87
87
|
if (state.show && !state.inview && !state.queued) {
|
|
@@ -99,7 +99,7 @@ export default {
|
|
|
99
99
|
} else if (!state.show && state.inview && !state.queued && this.repeat) {
|
|
100
100
|
this.toggle(el, false);
|
|
101
101
|
}
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
},
|
|
104
104
|
|
|
105
105
|
events: ['scroll', 'resize'],
|
package/src/js/core/toggle.js
CHANGED
|
@@ -216,10 +216,10 @@ export default {
|
|
|
216
216
|
const leaving = this.target.filter((el) => hasClass(el, this.clsLeave));
|
|
217
217
|
|
|
218
218
|
if (leaving.length) {
|
|
219
|
-
this.target
|
|
219
|
+
for (const el of this.target) {
|
|
220
220
|
const isLeaving = includes(leaving, el);
|
|
221
221
|
this.toggleElement(el, isLeaving, isLeaving);
|
|
222
|
-
}
|
|
222
|
+
}
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -26,17 +26,17 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
|
|
28
28
|
created() {
|
|
29
|
-
['start', 'move', 'end']
|
|
29
|
+
for (const key of ['start', 'move', 'end']) {
|
|
30
30
|
const fn = this[key];
|
|
31
31
|
this[key] = (e) => {
|
|
32
32
|
const pos = getEventPos(e).x * (isRtl ? -1 : 1);
|
|
33
33
|
|
|
34
|
-
this.prevPos = pos
|
|
34
|
+
this.prevPos = pos === this.pos ? this.prevPos : this.pos;
|
|
35
35
|
this.pos = pos;
|
|
36
36
|
|
|
37
37
|
fn(e);
|
|
38
38
|
};
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
},
|
|
41
41
|
|
|
42
42
|
events: [
|
|
@@ -61,7 +61,7 @@ export default {
|
|
|
61
61
|
methods: {
|
|
62
62
|
updateNav() {
|
|
63
63
|
const i = this.getValidIndex();
|
|
64
|
-
this.navItems
|
|
64
|
+
for (const el of this.navItems) {
|
|
65
65
|
const cmd = data(el, this.attrItem);
|
|
66
66
|
|
|
67
67
|
toggleClass(el, this.clsActive, toNumber(cmd) === i);
|
|
@@ -71,7 +71,7 @@ export default {
|
|
|
71
71
|
this.finite &&
|
|
72
72
|
((cmd === 'previous' && i === 0) || (cmd === 'next' && i >= this.maxIndex))
|
|
73
73
|
);
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
};
|
package/src/js/util/attr.js
CHANGED
|
@@ -11,17 +11,17 @@ export function attr(element, name, value) {
|
|
|
11
11
|
if (isUndefined(value)) {
|
|
12
12
|
return toNode(element)?.getAttribute(name);
|
|
13
13
|
} else {
|
|
14
|
-
toNodes(element)
|
|
14
|
+
for (const el of toNodes(element)) {
|
|
15
15
|
if (isFunction(value)) {
|
|
16
|
-
value = value.call(
|
|
16
|
+
value = value.call(el, attr(el, name));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (value === null) {
|
|
20
|
-
removeAttr(
|
|
20
|
+
removeAttr(el, name);
|
|
21
21
|
} else {
|
|
22
|
-
|
|
22
|
+
el.setAttribute(name, value);
|
|
23
23
|
}
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -30,16 +30,18 @@ export function hasAttr(element, name) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function removeAttr(element, name) {
|
|
33
|
-
|
|
34
|
-
name.split(' ')
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const elements = toNodes(element);
|
|
34
|
+
for (const attribute of name.split(' ')) {
|
|
35
|
+
for (const element of elements) {
|
|
36
|
+
element.removeAttribute(attribute);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export function data(element, attribute) {
|
|
40
|
-
for (
|
|
41
|
-
if (hasAttr(element,
|
|
42
|
-
return attr(element,
|
|
42
|
+
for (const name of [attribute, `data-${attribute}`]) {
|
|
43
|
+
if (hasAttr(element, name)) {
|
|
44
|
+
return attr(element, name);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
package/src/js/util/dom.js
CHANGED
|
@@ -80,29 +80,14 @@ export function unwrap(element) {
|
|
|
80
80
|
toNodes(element)
|
|
81
81
|
.map(parent)
|
|
82
82
|
.filter((value, index, self) => self.indexOf(value) === index)
|
|
83
|
-
.forEach((parent) =>
|
|
84
|
-
before(parent, parent.childNodes);
|
|
85
|
-
remove(parent);
|
|
86
|
-
});
|
|
83
|
+
.forEach((parent) => parent.replaceWith(...parent.childNodes));
|
|
87
84
|
}
|
|
88
85
|
|
|
89
|
-
const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
|
|
90
|
-
const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
|
91
|
-
|
|
92
86
|
export function fragment(html) {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const container = document.createElement('div');
|
|
99
|
-
if (fragmentRe.test(html)) {
|
|
100
|
-
container.insertAdjacentHTML('beforeend', html.trim());
|
|
101
|
-
} else {
|
|
102
|
-
container.textContent = html;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
|
|
87
|
+
const template = document.createElement('template');
|
|
88
|
+
template.innerHTML = html;
|
|
89
|
+
const { childNodes } = template.content;
|
|
90
|
+
return childNodes.length > 1 ? toNodes(childNodes) : childNodes[0];
|
|
106
91
|
}
|
|
107
92
|
|
|
108
93
|
export function apply(node, fn) {
|
package/src/js/util/position.js
CHANGED
|
@@ -95,14 +95,14 @@ export function positionAt(
|
|
|
95
95
|
if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
|
|
96
96
|
position[align] = newVal;
|
|
97
97
|
|
|
98
|
-
['element', 'target']
|
|
98
|
+
for (const el of ['element', 'target']) {
|
|
99
99
|
if (elemOffset) {
|
|
100
100
|
flipped[el][dir] =
|
|
101
101
|
flipped[el][dir] === dirs[prop][1]
|
|
102
102
|
? dirs[prop][2]
|
|
103
103
|
: dirs[prop][1];
|
|
104
104
|
}
|
|
105
|
-
}
|
|
105
|
+
}
|
|
106
106
|
|
|
107
107
|
return true;
|
|
108
108
|
}
|
package/src/js/util/promise.js
DELETED
|
File without changes
|