Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Uber-micro library (<1kb) for selecting elements and handling custom events. No dependencies. IE9+

NotificationsYou must be signed in to change notification settings

kevinweber/dime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Methods

  • elements =$('selector')
  • element =$('selector')[0]
  • element|elements.on()
  • element|elements.trigger()
  • elements.each()
  • element.find()

Usage

// Select multiple elements (querySelectorAll).$('.selector')// Iterate over elements.$('.selector').each(callback)// Attach one or more events (separated by a single space) to elements.$('.selector').on('event1 event2',callback)// Trigger a custom event on elements.$('.selector').trigger('eventName',data)// Select first element. Supports .on() and .trigger().$('.selector')[0]// Find elements within a single element. Supports .each(), .on(), .trigger().$('.selector')[0].find('.another-selector')

Design goals

  1. Simplicity. Very short learning curve and ease of use. The methods work on native DOM elements, even if they're not wrapped in$(). No need for.querySelectorAll or.querySelector.
  2. Minimalism. Small file size and high performance.

Notes

  • Dime.js adds methods to the nativeNodeList andNode prototypes. In consequence, if the native prototypes ever provide one of the methods this library provides, they will be overridden and no longer accessible. Despite the possibleproperty shadowing, we think this library is worth to be used. In the unlikely case a property gets overridden, we can refactor.
  • The.find() method is only supported on a single element ($elements[0].find('.selector')), not on a collection of elements, aka NodeList. So$elements.find('.selector') is not going to work.

About

Uber-micro library (<1kb) for selecting elements and handling custom events. No dependencies. IE9+

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp