-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I will leave two important points that made me give up using BVSelect, even though it visually meets my needs.
-
The selector cannot be an
Element, only an ID is completely limiting, making dynamic use difficult. This was the main point for giving up! -
The code scans the document countless times to pick up other elements
Something like that to instance element selector:
if (typeof selector === "string" ) {
switch (selector.charAt(0)) {
case '.':
selector = selector.substring(1);
this.element = document.getElementsByClassName(selector);
break;
default:
if (selector.charAt(0) === "#") {
selector = selector.substring(1);
}
this.element = document.getElementsByClassName(selector);
break;
}
} else if (selector instanceof Element) {
this.element = selector;
} else {
throw new Error("Invalid selector");
}Metadata
Metadata
Assignees
Labels
No labels