Skip to content

Commit

Permalink
refactor(HXCheckboxElement): remove need for htmlFor attr/prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan A. Johnson committed Feb 25, 2019
1 parent f9de838 commit fc3906d
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/helix-ui/elements/HXCheckboxElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { HXElement } from './HXElement';
import shadowMarkup from './HXCheckboxElement.html';
import shadowStyles from './HXCheckboxElement.less';

// TODO: add change/input listener to add '.hx-dirty' class to component wrapper (.hxCheckbox)

/**
* Defines behavior for the `<hx-checkbox>` element.
*
Expand Down Expand Up @@ -34,19 +36,7 @@ export class HXCheckboxElement extends HXElement {
* @type {HTMLElement}
*/
get controlElement () {
return this.getRootNode().querySelector(`[id="${this.htmlFor}"]`);
}

/**
* ID of associated checkbox control.
*
* @type {string}
*/
get htmlFor () {
return this.getAttribute('for') || '';
}
set htmlFor (value) {
this.setAttribute('for', value);
return this.parentNode.querySelector('input[type="checkbox"]');
}

/** @private */
Expand Down

0 comments on commit fc3906d

Please sign in to comment.