saloe 0.0.55 → 0.0.57
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/listener.cjs.js +12 -1
- package/dist/listener.es.js +12 -1
- package/package.json +1 -1
- package/src/listener.js +18 -2
package/dist/listener.cjs.js
CHANGED
|
@@ -149,6 +149,14 @@ const listener = ({
|
|
|
149
149
|
if (closestButton) return closestButton;
|
|
150
150
|
return srcElement;
|
|
151
151
|
};
|
|
152
|
+
const cloneSrcElement = ({ srcElement }) => {
|
|
153
|
+
const newSrcElement = document.createElement(srcElement == null ? void 0 : srcElement.tagName);
|
|
154
|
+
srcElement == null ? void 0 : srcElement.attributes.forEach((attr) => {
|
|
155
|
+
if (attr.startsWith("on-")) return;
|
|
156
|
+
newSrcElement.setAttribute(attr.name, attr.value);
|
|
157
|
+
});
|
|
158
|
+
return newSrcElement;
|
|
159
|
+
};
|
|
152
160
|
const fireAnchorClickListener = () => {
|
|
153
161
|
const anchors = document.querySelectorAll("a[on-click]");
|
|
154
162
|
anchors == null ? void 0 : anchors.forEach((anchor) => {
|
|
@@ -159,7 +167,10 @@ const listener = ({
|
|
|
159
167
|
const listeners = await fetchListeners({ srcElement, event, e });
|
|
160
168
|
executeListeners({ e, srcElement, listeners });
|
|
161
169
|
if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
|
|
162
|
-
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
const newAnchor = cloneSrcElement({ srcElement });
|
|
172
|
+
newAnchor.click();
|
|
173
|
+
}, 1e3);
|
|
163
174
|
});
|
|
164
175
|
});
|
|
165
176
|
};
|
package/dist/listener.es.js
CHANGED
|
@@ -147,6 +147,14 @@ const listener = ({
|
|
|
147
147
|
if (closestButton) return closestButton;
|
|
148
148
|
return srcElement;
|
|
149
149
|
};
|
|
150
|
+
const cloneSrcElement = ({ srcElement }) => {
|
|
151
|
+
const newSrcElement = document.createElement(srcElement == null ? void 0 : srcElement.tagName);
|
|
152
|
+
srcElement == null ? void 0 : srcElement.attributes.forEach((attr) => {
|
|
153
|
+
if (attr.startsWith("on-")) return;
|
|
154
|
+
newSrcElement.setAttribute(attr.name, attr.value);
|
|
155
|
+
});
|
|
156
|
+
return newSrcElement;
|
|
157
|
+
};
|
|
150
158
|
const fireAnchorClickListener = () => {
|
|
151
159
|
const anchors = document.querySelectorAll("a[on-click]");
|
|
152
160
|
anchors == null ? void 0 : anchors.forEach((anchor) => {
|
|
@@ -157,7 +165,10 @@ const listener = ({
|
|
|
157
165
|
const listeners = await fetchListeners({ srcElement, event, e });
|
|
158
166
|
executeListeners({ e, srcElement, listeners });
|
|
159
167
|
if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
|
|
160
|
-
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
const newAnchor = cloneSrcElement({ srcElement });
|
|
170
|
+
newAnchor.click();
|
|
171
|
+
}, 1e3);
|
|
161
172
|
});
|
|
162
173
|
});
|
|
163
174
|
};
|
package/package.json
CHANGED
package/src/listener.js
CHANGED
|
@@ -214,6 +214,17 @@ const listener = ({
|
|
|
214
214
|
return srcElement
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
const cloneSrcElement = ({ srcElement }) => {
|
|
218
|
+
const newSrcElement = document.createElement(srcElement?.tagName)
|
|
219
|
+
|
|
220
|
+
srcElement?.attributes.forEach((attr) => {
|
|
221
|
+
if (attr.startsWith('on-')) return
|
|
222
|
+
newSrcElement.setAttribute(attr.name, attr.value)
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
return newSrcElement
|
|
226
|
+
}
|
|
227
|
+
|
|
217
228
|
const fireAnchorClickListener = () => {
|
|
218
229
|
const anchors = document.querySelectorAll('a[on-click]')
|
|
219
230
|
anchors?.forEach((anchor) => {
|
|
@@ -226,8 +237,13 @@ const listener = ({
|
|
|
226
237
|
|
|
227
238
|
executeListeners({ e, srcElement, listeners })
|
|
228
239
|
if (srcElement?.removeAttribute) srcElement.removeAttribute(`on-${event}`)
|
|
229
|
-
|
|
230
|
-
|
|
240
|
+
|
|
241
|
+
setTimeout(() => {
|
|
242
|
+
const newAnchor = cloneSrcElement({ srcElement })
|
|
243
|
+
newAnchor.click()
|
|
244
|
+
}, 1_000)
|
|
245
|
+
|
|
246
|
+
// location.href = anchor.href
|
|
231
247
|
})
|
|
232
248
|
})
|
|
233
249
|
}
|