• Jump To … +
    chain.js classList.js collection.js delegate.js extend.js has.js invoke.js isBlank.js isFunction.js isObject.js isRegExp.js isString.js isUndefined.js mapEvents.js mapSelections.js matches.js pluck.js query.js queryAll.js result.js tap.js template.js tokenize.js util.js washi.js
  • mapSelections.js

  • ¶

    Given an object who’s keys are names and values are selectors, produce a new object with getters that select upon a given element.

    For example:

    mapSelection(document.body, { paragraphs: 'p', links: 'a' });
    
    var queryAll = require('./queryAll');
    var util     = require('./util');
    
    module.exports = function(el, ui) {
      var assignments = {};
  • ¶

    For each attribute, perform a selection within the context of this View’s element

      for (var component in ui) {
        assignments[component] = queryAll(el, ui[component]);
        assignments['$' + component] = util(assignments[component]);
      }
    
      return assignments;
    };