saloe 0.0.50 → 0.0.51

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.
@@ -149,6 +149,20 @@ const listener = ({
149
149
  if (closestButton) return closestButton;
150
150
  return srcElement;
151
151
  };
152
+ const fireAnchorClickListener = () => {
153
+ const anchors = document.querySelectorAll("a[on-click]");
154
+ anchors == null ? void 0 : anchors.forEach((anchor) => {
155
+ anchor.addEventListener(async (e) => {
156
+ e.preventDefault();
157
+ const srcElement = anchor;
158
+ const event = "click";
159
+ const listeners = await fetchListeners({ srcElement, event, e });
160
+ executeListeners({ e, srcElement, listeners });
161
+ if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
162
+ console.log("--- anchor.href =", anchor.href);
163
+ });
164
+ });
165
+ };
152
166
  const fireListeners = () => {
153
167
  EVENTS.forEach((event) => {
154
168
  document.body[`on${event}`] = async (e) => {
@@ -161,6 +175,7 @@ const listener = ({
161
175
  if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
162
176
  };
163
177
  });
178
+ fireAnchorClickListener();
164
179
  const saloeListenEvent = new CustomEvent("saloeListen", {
165
180
  detail: { message: "This is a custom event!" }
166
181
  });
@@ -147,6 +147,20 @@ const listener = ({
147
147
  if (closestButton) return closestButton;
148
148
  return srcElement;
149
149
  };
150
+ const fireAnchorClickListener = () => {
151
+ const anchors = document.querySelectorAll("a[on-click]");
152
+ anchors == null ? void 0 : anchors.forEach((anchor) => {
153
+ anchor.addEventListener(async (e) => {
154
+ e.preventDefault();
155
+ const srcElement = anchor;
156
+ const event = "click";
157
+ const listeners = await fetchListeners({ srcElement, event, e });
158
+ executeListeners({ e, srcElement, listeners });
159
+ if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
160
+ console.log("--- anchor.href =", anchor.href);
161
+ });
162
+ });
163
+ };
150
164
  const fireListeners = () => {
151
165
  EVENTS.forEach((event) => {
152
166
  document.body[`on${event}`] = async (e) => {
@@ -159,6 +173,7 @@ const listener = ({
159
173
  if (srcElement == null ? void 0 : srcElement.removeAttribute) srcElement.removeAttribute(`on-${event}`);
160
174
  };
161
175
  });
176
+ fireAnchorClickListener();
162
177
  const saloeListenEvent = new CustomEvent("saloeListen", {
163
178
  detail: { message: "This is a custom event!" }
164
179
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saloe",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "Tools for making web development easy and efficient",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/listener.js CHANGED
@@ -247,6 +247,8 @@ const listener = ({
247
247
  }
248
248
  })
249
249
 
250
+ fireAnchorClickListener()
251
+
250
252
  const saloeListenEvent = new CustomEvent('saloeListen', {
251
253
  detail: { message: 'This is a custom event!' }
252
254
  })