+ `;
+ this.canvas = this.shadowRoot.querySelector("canvas");
+ }
+
+ set data (data) {
+ this.canvas.role = "img";
+ this.canvas.ariaLabel = data.ariaLabel;
+ createChart(this.canvas, data.chart);
+ }
+
+ get data () {
+ return null;
+ }
+}
+
+function createChart (ctx, data) {
+ return new Chart(ctx, data);
+}
+
+customElements.define("custom-chart", CustomChart);
diff --git a/scripts/draggable.js b/scripts/draggable.js
index 215b944..765ce12 100644
--- a/scripts/draggable.js
+++ b/scripts/draggable.js
@@ -5,7 +5,7 @@ const draggableItemUUIDs = {};
* Get the data transfer source object by parsing its types. Valid draggable-item events have one type of the format `application/json/${uuid}`.
* The function takes the entire type list from event.dataTransfer.types and returns the source object if valid, or null if invalid.
* @param {*} typesList from event.dataTransfer.types
- * @returns {Object} Object containing the type, uuid, and element of the dataTransfer source or null
+ * @returns {Object} Object containing the type, uuid, and element of the dataTransfer source or null
*/
function getDragSource (typesList) {
if (typesList.length !== 1) {
diff --git a/scripts/instance.js b/scripts/instance.js
index c3425a9..2ba792d 100644
--- a/scripts/instance.js
+++ b/scripts/instance.js
@@ -77,8 +77,10 @@ class InstanceCard extends HTMLElement {
const nameParagraph = this.shadowRoot.querySelector("#instance-name");
if (this.searchQuery) {
- const regEscape = v => v.replace("[-[\]{}()*+?.,\\^$|#\s]", "\\$&");
- const nameParts = this.name.split(new RegExp(regEscape(`(${this.searchQuery})`), "ig"));
+ const regExpEscape = v => v.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+ const escapedQuery = regExpEscape(this.searchQuery);
+ const searchRegExp = new RegExp(`(${escapedQuery})`, "gi");
+ const nameParts = this.name.split(searchRegExp);
for (let i = 0; i < nameParts.length; i++) {
const part = document.createElement("span");
part.innerText = nameParts[i];