Helpers - RomainValy/ToDoMVC-OpenclassRoom-project GitHub Wiki

Tools what we need!

Table of Contents

qs

Get element(s) by CSS selector:

Parameters

  • selector
  • scope

$on

addEventListener wrapper:

Parameters

  • target
  • type
  • callback
  • useCapture

$delegate

Attach a handler to event for all elements that match the selector, now or in the future, based on a root element

Parameters

  • target
  • selector
  • type
  • handler

$parent

Find the element's parent with the given tag name:

Parameters

  • element
  • tagName

Examples

$parent(qs('a'), 'div');

useCapture

https://developer.mozilla.org/en-US/docs/Web/Events/blur

forEach

Allow for looping on nodes by chaining:

Examples

qsa('.foo').forEach(function () {})