@domql/router 3.7.4 → 3.7.5

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/cjs/index.js CHANGED
@@ -239,14 +239,14 @@ const router = (path, el, state = {}, options = {}) => {
239
239
  { contentElementKey }
240
240
  );
241
241
  }
242
- if (opts.scrollToTop) {
242
+ if (opts.scrollToTop && scrollNode?.scrollTo) {
243
243
  scrollNode.scrollTo({
244
244
  ...opts.scrollToOptions || {},
245
245
  top: 0,
246
246
  left: 0
247
247
  });
248
248
  }
249
- if (opts.scrollToNode) {
249
+ if (opts.scrollToNode && content[contentElementKey]?.node?.scrollTo) {
250
250
  content[contentElementKey].node.scrollTo({
251
251
  ...opts.scrollToOptions || {},
252
252
  top: 0,
@@ -255,7 +255,7 @@ const router = (path, el, state = {}, options = {}) => {
255
255
  }
256
256
  if (hash) {
257
257
  const activeNode = doc.getElementById(hash);
258
- if (activeNode) {
258
+ if (activeNode && scrollNode?.scrollTo) {
259
259
  const top = activeNode.getBoundingClientRect().top + rootNode.scrollTop - (opts.scrollToOffset || 0);
260
260
  scrollNode.scrollTo({
261
261
  ...opts.scrollToOptions || {},
package/dist/esm/index.js CHANGED
@@ -208,14 +208,14 @@ const router = (path, el, state = {}, options = {}) => {
208
208
  { contentElementKey }
209
209
  );
210
210
  }
211
- if (opts.scrollToTop) {
211
+ if (opts.scrollToTop && scrollNode?.scrollTo) {
212
212
  scrollNode.scrollTo({
213
213
  ...opts.scrollToOptions || {},
214
214
  top: 0,
215
215
  left: 0
216
216
  });
217
217
  }
218
- if (opts.scrollToNode) {
218
+ if (opts.scrollToNode && content[contentElementKey]?.node?.scrollTo) {
219
219
  content[contentElementKey].node.scrollTo({
220
220
  ...opts.scrollToOptions || {},
221
221
  top: 0,
@@ -224,7 +224,7 @@ const router = (path, el, state = {}, options = {}) => {
224
224
  }
225
225
  if (hash) {
226
226
  const activeNode = doc.getElementById(hash);
227
- if (activeNode) {
227
+ if (activeNode && scrollNode?.scrollTo) {
228
228
  const top = activeNode.getBoundingClientRect().top + rootNode.scrollTop - (opts.scrollToOffset || 0);
229
229
  scrollNode.scrollTo({
230
230
  ...opts.scrollToOptions || {},
@@ -586,14 +586,14 @@ var DomqlRouter = (() => {
586
586
  { contentElementKey }
587
587
  );
588
588
  }
589
- if (opts.scrollToTop) {
589
+ if (opts.scrollToTop && scrollNode?.scrollTo) {
590
590
  scrollNode.scrollTo({
591
591
  ...opts.scrollToOptions || {},
592
592
  top: 0,
593
593
  left: 0
594
594
  });
595
595
  }
596
- if (opts.scrollToNode) {
596
+ if (opts.scrollToNode && content[contentElementKey]?.node?.scrollTo) {
597
597
  content[contentElementKey].node.scrollTo({
598
598
  ...opts.scrollToOptions || {},
599
599
  top: 0,
@@ -602,7 +602,7 @@ var DomqlRouter = (() => {
602
602
  }
603
603
  if (hash) {
604
604
  const activeNode = doc.getElementById(hash);
605
- if (activeNode) {
605
+ if (activeNode && scrollNode?.scrollTo) {
606
606
  const top = activeNode.getBoundingClientRect().top + rootNode.scrollTop - (opts.scrollToOffset || 0);
607
607
  scrollNode.scrollTo({
608
608
  ...opts.scrollToOptions || {},
package/index.js CHANGED
@@ -270,14 +270,14 @@ export const router = (path, el, state = {}, options = {}) => {
270
270
  )
271
271
  }
272
272
 
273
- if (opts.scrollToTop) {
273
+ if (opts.scrollToTop && scrollNode?.scrollTo) {
274
274
  scrollNode.scrollTo({
275
275
  ...(opts.scrollToOptions || {}),
276
276
  top: 0,
277
277
  left: 0
278
278
  })
279
279
  }
280
- if (opts.scrollToNode) {
280
+ if (opts.scrollToNode && content[contentElementKey]?.node?.scrollTo) {
281
281
  content[contentElementKey].node.scrollTo({
282
282
  ...(opts.scrollToOptions || {}),
283
283
  top: 0,
@@ -287,7 +287,7 @@ export const router = (path, el, state = {}, options = {}) => {
287
287
 
288
288
  if (hash) {
289
289
  const activeNode = doc.getElementById(hash)
290
- if (activeNode) {
290
+ if (activeNode && scrollNode?.scrollTo) {
291
291
  const top =
292
292
  activeNode.getBoundingClientRect().top +
293
293
  rootNode.scrollTop -
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/router",
3
- "version": "3.7.4",
3
+ "version": "3.7.5",
4
4
  "license": "CC-BY-NC-4.0",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -27,8 +27,8 @@
27
27
  "prepublish": "npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/element": "^3.7.4",
31
- "@domql/utils": "^3.7.4"
30
+ "@domql/element": "^3.7.5",
31
+ "@domql/utils": "^3.7.5"
32
32
  },
33
33
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
34
34
  "devDependencies": {