Have ideas to improve npm?Join in the discussion! »

    qc-dom_utils

    0.1.1 • Public • Published

    qc-dom_utils

    Build Status License Downloads

    npm badge

    A set of utilities for working with the DOM. Utilities found in other major libraries such as jQuery will not be found here unless there is a good reason.

    The structure of this package allows importing only the utilities used. See the Example Usage section below. If you choose, you can import the entire library or subsets of the library. All of which depends on how you script the import statements.

    Installation

    npm install --save qc-dom_utils

    or

    yarn add qc-dom_utils

    Example Usage

    // Import entire library
    import DomUtils from 'qc-dom_utils'
     
    let elem = DomUtils.get('myElem')
    let formElem = DomUtils.form.get('myForm')
    // Import just the `get` utility
    import get from 'qc-dom_utils/get'
     
    let elem = get('myElem')
    // Import just the form subset of utilities
    import FormUtils from 'qc-dom_utils/form'
     
    let formElem = FormUtils.get('myForm')
    let firstInvalidElem = FormUtils.focusFirstInvalid('myForm', {
      ...
      lastname: '...',
      addressLn1: '...',
      addressLn2: false,
      city: false,
      state: '...',
      ...
    })
    // Import just the `get` utility from the `form` namespace
    import getForm from 'qc-dom_utils/form/get'
     
    let formElem = getForm('myForm')
    // Import just the `focusFirstInvalidInputControl` utility from the `form` namespace
    import focusFirstInvalid from 'qc-dom_utils/form/focusFirstInvalidInputControl'
     
    let firstInvalidElem = focusFirstInvalid('myForm', { ... })

    Common JS

    const DomUtils = require('qc-dom_utils/lib/cjs').default
    ...
    const get = require('qc-dom_utils/lib/cjs/get').default
    ...
    const FormUtils = require('qc-dom_utils/lib/cjs/form').default
    ...
    const get = require('qc-dom_utils/lib/cjs/form/get').default
    ...
    const focusFirstInvalid = require('qc-dom_utils/lib/cjs/form/focusFirstInvalidInputControl').default
    ...

    Install

    npm i qc-dom_utils

    DownloadsWeekly Downloads

    1

    Version

    0.1.1

    License

    ISC

    Last publish

    Collaborators

    • avatar