http://dom.spec.whatwg.org/#mutation-method-macro
356334
function _mutation(nodes) { // eslint-disable-line no-unused-vars
	if (!nodes.length) {
		throw new Error('DOM Exception 8');
	} else if (nodes.length === 1) {
		return typeof nodes[0] === 'string' ? document.createTextNode(nodes[0]) : nodes[0];
	} else {
		var
		fragment = document.createDocumentFragment(),
		length = nodes.length,
		index = -1,
		node;

		while (++index < length) {
			node = nodes[index];

			fragment.appendChild(typeof node === 'string' ? document.createTextNode(node) : node);
		}

		return fragment;
	}
}
252994
@Override
  protected void visitSoyFileNode(SoyFileNode node) {
    StringBuilder file = new StringBuilder();

    file.append("// This file was automatically generated from ")
        .append(node.getFileName())
        .append(".\n");
    file.append("// Please don't edit this file by hand.\n");

    // Output a section containing optionally-parsed compiler directives in comments. Since these
    // are comments, they are not controlled by an option, and will be removed by minifiers that do
    // not understand them.
    file.append("\n");
    String fileOverviewDescription = "Templates in namespace " + node.getNamespace() + ".";
    JsDoc.Builder jsDocBuilder = JsDoc.builder();
    jsDocBuilder.addAnnotation("fileoverview", fileOverviewDescription);
    if (node.getDelPackageName() != null) {
      jsDocBuilder.addParameterizedAnnotation("modName", node.getDelPackageName());
    }
    addJsDocToProvideDelTemplates(jsDocBuilder, node);
    addJsDocToRequireDelTemplates(jsDocBuilder, node);
    addCodeToRequireCss(jsDocBuilder, node);
    jsDocBuilder.addAnnotation("public");
    file.append(jsDocBuilder.build());
    file.append("\n\n");

    // Add code to define JS namespaces or add provide/require calls for Closure Library.
    templateAliases = AliasUtils.IDENTITY_ALIASES;
    jsCodeBuilder = createCodeBuilder();

    if (jsSrcOptions.shouldGenerateGoogModules()) {
      templateAliases = AliasUtils.createTemplateAliases(node);

      addCodeToDeclareGoogModule(file, node);
      addCodeToRequireGoogModules(node);
    } else if (jsSrcOptions.shouldProvideRequireSoyNamespaces()) {
      addCodeToProvideSoyNamespace(file, node);
      file.append('\n');
      addCodeToRequireSoyNamespaces(node);
    } else {
      throw new AssertionError("impossible");
    }

    // add declarations for the ijdata params
    // This takes advantage of the way '@record' types in closure are 'open'.
    // Unfortunately clutz doesn't understand this:
    // https://github.com/angular/clutz/issues/832
    // So TS users will not be able to see the property definitions.
    // The most practical solution to that is for soy to generate its own .d.ts files.
    Map<String, SoyType> ijData = getAllIjDataParams(node);
    if (!ijData.isEmpty()) {
      GoogRequire require = GoogRequire.create("soy");
      jsCodeBuilder.appendLine();
      for (Map.Entry<String, SoyType> entry : ijData.entrySet()) {
        jsCodeBuilder.appendLine();
        //
        jsCodeBuilder.appendLine(
            JsDoc.builder()
                // Because every declaration can declare a type, we can get errors if they don't
                // declare identical types.  There isn't a good way to force identical declarations
                // so we just suppress the duplicate error warning.
                .addParameterizedAnnotation("suppress", "duplicate")
                // declare every field as optional.  This is because if a template is unused and
                // declares an ij param we don't want to force people to supply a value.
                .addParameterizedAnnotation(
                    "type",
                    getJsTypeForParamForDeclaration(entry.getValue()).typeExpr() + "|undefined")
                .build()
                .toString());
        jsCodeBuilder.append(
            require
                .reference()
                .dotAccess("IjData")
                .dotAccess("prototype")
                .dotAccess(entry.getKey())
                .asStatement());
      }
    }

    // Add code for each template.
    for (TemplateNode template : node.getChildren()) {
      jsCodeBuilder.appendLine().appendLine();
      staticVarDeclarations = new ArrayList<>();
      visit(template);
      if (!staticVarDeclarations.isEmpty()) {
        jsCodeBuilder.append(Statement.of(staticVarDeclarations));
      }
    }
    jsCodeBuilder.appendGoogRequiresTo(file);
    jsCodeBuilder.appendCodeTo(file);
    jsFilesContents.add(file.toString());
    jsCodeBuilder = null;
  }
894563
function () {
                        //noinspection JSReferencingMutableVariableFromClosure
                        res.push({
                            combine: 1,
                            path: prefix + currentComboUrls.join(comboSep) + suffix,
                            mods: currentComboMods
                        });
                    }
1010828
function mutation(target, handler) {
    target.addEventListener("mutation", function(evt) {
        handler.call(this, this, evt.mutations);
    });
}
139640
def _modify(self, **patch):
        """"""

        requests_params, patch_uri, session, read_only = \
            self._prepare_put_or_patch(patch)
        self._check_for_boolean_pair_reduction(patch)
        read_only_mutations = []
        for attr in read_only:
            if attr in patch:
                read_only_mutations.append(attr)
        if read_only_mutations:
            msg = 'Attempted to mutate read-only attribute(s): %s' \
                % read_only_mutations
            raise AttemptedMutationOfReadOnly(msg)

        patch = self._prepare_request_json(patch)
        response = session.patch(patch_uri, json=patch, **requests_params)
        self._local_update(response.json())
611540
def macro(parser, token):
    '''
    
    '''
    name = token.strip()
    parser.build_method(name, endnodes=['endmacro'])
    return ast.Yield(value=ast.Str(s=''))
1143300
function(d) {
      if (!d.isCaching && d.addEventListener) {
        // FireFox/Opera/Safari/KHTML have support for Mutation Events
        d.addEventListener('DOMAttrModified', mutationWrapper, true);
        d.addEventListener('DOMNodeInserted', mutationWrapper, true);
        d.addEventListener('DOMNodeRemoved',  mutationWrapper, true);
        d.isCaching = true;
      }
    }
1341563
function(input) {
  var code = '';

  var unparsedInput = input;
  var unparsedInputLength;
  var output;

  do {
    var section = toplevel(unparsedInput);
    unparsedInputLength = unparsedInput.length;
    if (section.zone === null) {
      output = unparsedInput;
      code += '$_write('
        + JSON.stringify(escapeCurly(output, section.escapes))
        + ');\n';
      break;
    }
    var span = unparsedInput.slice(section.zone.from + 2, section.zone.to - 2);
    var params = zoneParser(span);    // Fragment the parameters.
    var macro = params[0];

    output = unparsedInput.slice(0, section.zone.from);
    code += '$_write('
      + JSON.stringify(escapeCurly(output, section.escapes))
      + ');\n';

    // If the macro is not present, print the zone directly.
    if (macros[macro] === undefined) {
      output = unparsedInput.slice(section.zone.from, section.zone.to);
      code += '$_write('
        + JSON.stringify(escapeCurly(output, section.escapes))
        + ');\n';
      unparsedInput = unparsedInput.slice(section.zone.to);
      continue;
    }
    // If the macro is empty, this is code.
    if (macro === "") {
      code += params.slice(1).join('') + '\n';
      unparsedInput = unparsedInput.slice(section.zone.to);
      continue;
    }

    // Call the macro.
    var errmsg = JSON.stringify([
      'Template error: macro "MACRO" didn\'t work.',
      'Parameters: PARAMS',
      'Literal: LITERAL',
      'Message: MESSAGE'
    ].join('\n'))
     .replace('MACRO', '" + ' + JSON.stringify(macro) + ' + "')
     .replace('MESSAGE', '" + e.message + "')
     .replace('PARAMS', '" + ' + JSON.stringify(params.slice(1)) + ' + "')
     .replace('LITERAL', '" + $_scopestr + "');
    var macrocode = macros[macro](params.slice(1));
    code += [
      'try {',
      '  ' + macrocode,
      '} catch(e) {',
      '  try {',
      '    var $_scopestr = JSON.stringify($_scope);',
      '  } catch(e) { var $_scopestr = Object.keys($_scope).join(" "); }',
      '  throw Error (' + errmsg + ');',
      '}'
    ].join('\n');

    unparsedInput = unparsedInput.slice(section.zone.to);
  } while (section.zone.to < unparsedInputLength);

  return code;
}
1270840
private static Mutation createDeleteColumnMutation(byte[] colName, long timestamp) {
        SlicePredicate slicePred = new SlicePredicate();
        slicePred.addToColumn_names(ByteBuffer.wrap(colName));
        
        Deletion deletion = new Deletion();
        deletion.setPredicate(slicePred);
        deletion.setTimestamp(timestamp);
        
        Mutation mutation = new Mutation();
        mutation.setDeletion(deletion);
        return mutation;
    }
320905
function (mutationRecordsList) {
    var $target = $(mutationRecordsList[0].target);

    //trigger the event handler for the element depending on type
    switch (mutationRecordsList[0].type) {
      case "attributes":
        if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") {
          $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
        }
        if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") {
          $target.triggerHandler('resizeme.zf.trigger', [$target]);
         }
        if (mutationRecordsList[0].attributeName === "style") {
          $target.closest("[data-mutate]").attr("data-events","mutate");
          $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
        }
        break;

      case "childList":
        $target.closest("[data-mutate]").attr("data-events","mutate");
        $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
        break;

      default:
        return false;
      //nothing
    }
  }
817364
def do_usemacro(parser, token):
    
    tag_name, macro_name, args, kwargs = parse_macro_params(token)
    try:
        macro = parser._macros[macro_name]
    except (AttributeError, KeyError):
        raise template.TemplateSyntaxError(
            "Macro '{0}' is not defined previously to the {1} tag".format(
                macro_name, tag_name))
    macro.parser = parser
    return UseMacroNode(macro, args, kwargs)
1097712
function transpileDerivedExchangeClass (contents) {

    let exchangeClassDeclarationMatches = contents.match (/^module\.exports\s*=\s*class\s+([\S]+)\s+extends\s+([\S]+)\s+{([\s\S]+?)^};*/m)

    // log.green (file, exchangeClassDeclarationMatches[3])

    let className = exchangeClassDeclarationMatches[1]
    let baseClass = exchangeClassDeclarationMatches[2]

    let methods = exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/)

    let python2 = []
    let python3 = []
    let php = []

    let methodNames = []

    // run through all methods
    for (let i = 0; i < methods.length; i++) {
        // parse the method signature
        let part = methods[i].trim ()
        let lines = part.split ("\n")
        let signature = lines[0].trim ()
        let methodSignatureRegex = /(async |)([\S]+)\s\(([^)]*)\)\s*{/ // signature line
        let matches = methodSignatureRegex.exec (signature)

        if (!matches) {
            log.red (methods[i])
            log.yellow.bright ("\nMake sure your methods don't have empty lines!\n")
        }

        // async or not
        let keyword = matches[1]
        // try {
        //     keyword = matches[1]
        // } catch (e) {
        //     log.red (e)
        //     log.green (methods[i])
        //     log.yellow (exchangeClassDeclarationMatches[3].trim ().split (/\n\s*\n/))
        //     process.exit ()
        // }

        // method name
        let method = matches[2]

        methodNames.push (method)

        method = unCamelCase (method)

        // method arguments
        let args = matches[3].trim ()

        // extract argument names and local variables
        args = args.length ? args.split (',').map (x => x.trim ()) : []

        // get names of all method arguments for later substitutions
        let variables = args.map (arg => arg.split ('=').map (x => x.trim ()) [0])

        // add $ to each argument name in PHP method signature
        let phpArgs = args.join (', $').trim ().replace (/undefined/g, 'null').replace ('{}', 'array ()')
        phpArgs = phpArgs.length ? ('$' + phpArgs) : ''

        // remove excessive spacing from argument defaults in Python method signature
        let pythonArgs = args.map (x => x.replace (' = ', '='))
                                .join (', ')
                                .replace (/undefined/g, 'None')
                                .replace (/false/g, 'False')
                                .replace (/true/g, 'True')

        // method body without the signature (first line)
        // and without the closing bracket (last line)
        let js = lines.slice (1, -1).join ("\n")

        // transpile everything
        let { python3Body, python2Body, phpBody } = transpileJavaScriptToPythonAndPHP ({ js, className, variables, removeEmptyLines: true })

        // compile the final Python code for the method signature
        let pythonString = 'def ' + method + '(self' + (pythonArgs.length ? ', ' + pythonArgs : '') + '):'

        // compile signature + body for Python 2
        python2.push ('');
        python2.push ('    ' + pythonString);
        python2.push (python2Body);

        // compile signature + body for Python 3
        python3.push ('');
        python3.push ('    ' + keyword + pythonString);
        python3.push (python3Body);

        // compile signature + body for PHP
        php.push ('');
        php.push ('    public function ' + method + ' (' + phpArgs + ') {');
        php.push (phpBody);
        php.push ('    }')

    }

    return {

        // altogether in PHP, Python 2 and 3
        python2: createPythonClass (className, baseClass, python2, methodNames),
        python3: createPythonClass (className, baseClass, python3, methodNames, true),
        php:     createPHPClass    (className, baseClass, php,     methodNames),

        className,
        baseClass,
    }
}
956878
def macro_apply(self, id, **kwargs):
        ""
        api_path = "/api/v2/macros/{id}/apply.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
723760
function compiler(dom, directive, data, ans){
    var fns = [];
    // autoRendering nodes parsing -> auto-nodes
    ans = ans || data && getAutoNodes(dom, data);
    if(data){
      var j, jj, cspec, n, target, nodes, itersel, node, inner;
      // for each auto-nodes
      while(ans.length > 0){
        cspec = ans[0].cspec;
        n = ans[0].n;
        ans.splice(0, 1);
        if(cspec.t === 'str'){
          // if the target is a value
          target = gettarget(n, cspec, false);
          setsig(target, fns.length);
          fns[fns.length] = wrapquote(target.quotefn, dataselectfn(cspec.prop));
        }else{
          // if the target is a loop
          itersel = dataselectfn(cspec.sel);
          target = gettarget(n, cspec, true);
          nodes = target.nodes;
          for(j = 0, jj = nodes.length; j < jj; j++){
            node = nodes[j];
            inner = compiler(node, false, data, ans);
            fns[fns.length] = wrapquote(target.quotefn, loopfn(cspec.sel, itersel, inner));
            target.nodes = [node];
            setsig(target, fns.length - 1);
          }
        }
      }
    }
    // read directives
    var target, dsel;
    for(var sel in directive){
      if(directive.hasOwnProperty(sel)){
        dsel = directive[sel];
        if(typeof(dsel) === 'function' || typeof(dsel) === 'string'){
          // set the value for the node/attr
          target = gettarget(dom, sel, false);
          setsig(target, fns.length);
          fns[fns.length] = wrapquote(target.quotefn, dataselectfn(dsel));
        }else{
          // loop on node
          loopgen(dom, sel, dsel, fns);
        }
      }
    }
        // convert node to a string
        var h = outerHTML(dom), pfns = [];
    // IE adds an unremovable "selected, value" attribute
    // hard replace while waiting for a better solution
        h = h.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig, "<$1 $3>");

        // remove attribute prefix
        h = h.split(attPfx).join('');

    // slice the html string at "Sig"
    var parts = h.split( Sig ), p;
    // for each slice add the return string of
    for(var i = 1; i < parts.length; i++){
      p = parts[i];
      // part is of the form "fn-number:..." as placed there by setsig.
      pfns[i] = fns[ parseInt(p, 10) ];
      parts[i] = p.substring( p.indexOf(':') + 1 );
    }
    return concatenator(parts, pfns);
  }
312160
function genWeavePropFn( d ) {
	var code = "";
	for (var i=0; i<d; ++i) {
		if (i !== 0) code += ",";
		code += "p[i+c*"+i+"]";
	}
	return new Function( "p", "i", "var c=p.length/"+d+";return ["+code+"]" );
}
63931
function compileTemplate(name) {
        // Directive compile function
        return function (tElement, tAttrs, transclude) {
            var rootElement = document.createElement("div");
            Object.keys(tAttrs).forEach(function (key) {
                if (key[0] !== '$') {
                    rootElement.setAttribute(key, tAttrs[key]);
                }
            });
            var immediateToken;
            // Directive link function
            return function ($scope, elements, attrs, parents) {
                var parent = parents.reduce(function (found, item) { return found || item; });
                parent[name] = function (itemPromise) {
                    // Actual item renderer
                    return WinJS.Promise.as(itemPromise).then(function (item) {
                        var itemScope = $scope.$new();
                        itemScope.item = item;
                        var result = rootElement.cloneNode(false);
                        transclude(itemScope, function (clonedElement) {
                            for (var i = 0, len = clonedElement.length; i < len; i++) {
                                result.appendChild(clonedElement[i]);
                            }
                        });
                        WinJS.Utilities.markDisposable(result, function () {
                            itemScope.$destroy();
                        });
                        immediateToken = immediateToken || setImmediate(function () {
                            immediateToken = null;
                            itemScope.$apply();
                        });
                        return result;
                    })
                };
            };
        };
    }
184420
function mutate(Component, title, api = {}) {
  class Mutated extends React.Component {
    constructor(props, context) {
      super(props);

      this.ToRender = Component;
      const mutations = context.mutations;

      if (!mutations || !mutations[title]) {
        return;
      }

      // Convert old style mutations to new style mutations
      if (!Array.isArray(mutations[title])) {
        mutations[title] = [mutations[title]];
      }

      // Apply all mutations to the component
      for (let mut of mutations[title]) {
        this.ToRender = mut(this.ToRender, api);
      }
    }

    render() {
      const ToRender = this.ToRender;
      return <ToRender {...this.props} />;
    }
  }

  Mutated.contextTypes = {
    mutations: PropTypes.object
  };

  return Mutated;
}