adamgian / minify-selectors

Post-processor to minify class and ID selector names.
Apache License 2.0
8 stars 0 forks source link

Consider JS children property #38

Closed adamgian closed 7 months ago

adamgian commented 1 year ago

Given:

<form>
  <input id="input-a" type="text" value="foo">
  <input id="input-b" type="text" value="bar">
  <input id="input-c" type="text" value="baz">
</form>

You can use square bracket operator on the .children property to access a child element with that ID string. The ID within the brackets will need to be minified.

let form = document.querySelector("form");
console.log(form.children["input-c"].value); // "bar"
adamgian commented 7 months ago

Has been addressed 9e9fe127909e9e4902ab247aaf995adbdd1a6772