1.0.0 • Published 4 years ago

fancy-props v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

fancy-props

DOM nodes have an eclectic (horrible) collection of properties and attributes, this library attempts to bring sanity to setting and getting them.

Usage

npm i --save fancy-props
var fancyProps = require('fancyProps')

var myDateInput = document.createElement('date')

myDateInput.value; // -> ""

fancyProps.value(someDateInput); // -> null

myDateInput.value = new Date('2020-01-01') // Does not work

myDateInput.value; // -> ""

fancyProps.value(someDateInput, new Date('2020-01-01')); // Set the date

myDateInput.value; // -> "2020-01-01"

fancyProps.value(someDateInput); // -> An actual date object eg: Wed Jan 01 2020 10:00:00 ... etc

Supported properties:

  • class
  • display
  • disabled
  • innerHTML
  • value
  • max
  • style
  • type
  • textContent
  • innerText
1.0.0

4 years ago