Skip to content

Commit

Permalink
fix: removed redundant prtotype, HTMLElement can handle all elements
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Dec 14, 2024
1 parent 93a9d0e commit 876d2c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
12 changes: 2 additions & 10 deletions src/getValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@ HTMLElement.prototype.getValue = function () {
return value;
};

HTMLInputElement.prototype.getValue = function () {
let value = getValue(this);
return value;
};

HTMLHeadingElement.prototype.getValue = function () {
let value = getValue(this);
return value;
};

// TODO: check if using a a switch case will provide better performance
// return blobs for element.src and for link.href
// pass value type as a param
const getValue = (element) => {
let value = element.value || element.getAttribute("value") || "";
if (
Expand Down
8 changes: 0 additions & 8 deletions src/setValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ HTMLElement.prototype.setValue = function (value, dispatch) {
setValue(this, value, dispatch);
};

HTMLInputElement.prototype.setValue = function (value, dispatch) {
setValue(this, value, dispatch);
};

HTMLHeadingElement.prototype.setValue = function (value, dispatch) {
setValue(this, value, dispatch);
};

// TODO: check if using a a switch case will provide better performance
const setValue = (el, value, dispatch) => {
let bubbles = el.hasAttribute("value-bubbles");
Expand Down

0 comments on commit 876d2c0

Please sign in to comment.