ANovokmet / svelte-gantt

:calendar: Interactive JavaScript Gantt chart/resource booking component

Home Page:https://anovokmet.github.io/svelte-gantt/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix: querySelector usage in selectTask() throws Uncaught DOMException

gubeils opened this issue · comments

Issue Description

While invoking selectTask() in src/Gantt.svelte, the method throws an Uncaught DOMException. The issue is due to an invalid selector string being passed to querySelector.

Error Message:

Uncaught DOMException: Failed to execute 'querySelector' on 'Element': 'data-task-id='50'' is not a valid selector.

Location

The issue occurs at line 567 of src/Gantt.svelte.

Proposed Solution

The current selector:

`data-task-id='${id}'`
Should be updated to use a proper [attribute selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) syntax:
`[data-task-id='${id}']`

Enclosing the attribute selector in square brackets should resolve the Uncaught DOMException error, allowing querySelector to match elements as expected.

Thank you! You are right.

Related, I don't like the relevant code that queries the DOM to select a task...

I'll get to fixing it as soon as possible.