Get type selector node
@return {Node}
512066
function getTypeSelector() {
  const type = NodeType.TypeSelectorType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  let content = [];

  if (checkNamePrefix(pos)) content.push(getNamePrefix());

  content = content.concat(getIdentOrInterpolation());

  return newNode(type, content, line, column);
}
1246614
function () {
            var node, sel, range;
            if (window.getSelection) {
                sel = window.getSelection();
                if (sel.rangeCount) {
                    range = sel.getRangeAt(0);
                    if (!range.collapsed) {
                        node = sel.anchorNode.parentNode;
                    }
                }
            } else if (document.selection) {
                node = document.selection.createRange().parentElement();
            }
            return node;
        }
142951
function getSelector(Module, selector) {
  // Verify that a base selector is defined.
  if (typeof selector === 'undefined') {
    if (Module.Selectors && Module.Selectors.BASE) {
      return Module.Selectors.BASE;
    }

    // Support both `ClassName` and `Classes` enumerations.
    const classes = Module.ClassName || Module.Classes;
    if (classes && classes.BASE) {
      return '.' + classes.BASE;
    }

    throw new TypeError('A base selector for this module must be specified.');
  }

  return selector;
}
1141603
function getCommonSelectors (elements) {

  const { classes, attributes, tag } = getCommonProperties(elements)

  const selectorPath = []

  if (tag) {
    selectorPath.push(tag)
  }

  if (classes) {
    const classSelector = classes.map((name) => `.${name}`).join('')
    selectorPath.push(classSelector)
  }

  if (attributes) {
    const attributeSelector = Object.keys(attributes).reduce((parts, name) => {
      parts.push(`[${name}="${attributes[name]}"]`)
      return parts
    }, []).join('')
    selectorPath.push(attributeSelector)
  }

  if (selectorPath.length) {
    // TODO: check for parent-child relation
  }

  return [
    selectorPath.join('')
  ]
}
297985
function(selector) {
        var nodelist = Y.all(Y.Selector.query(selector, this._node));
        nodelist._query = selector;
        nodelist._queryRoot = this._node;
        return nodelist;
    }
475801
function getFilterFunc(selector, context) {
    function wordRegExpTester(name, prop) {
      var re = RegExp('(^|\\s+)' + name + '(?=$|\\s)', 'i');
      return function(obj) {return  name ? re.test(obj[prop]) : true;};
    }

    var nodeSet = {};
    var dotPos = nodeSet;
    if (isFunction(selector))
      return selector;
    else if (isNumber(selector))
      return function(v, index) { return index == selector; };
    else if (!selector || selector == '*' ||
             (isString(selector) && (dotPos = /^([\w-]*)\.?([\w-]*)$/.exec(selector)))) {
      var nodeNameFilter = wordRegExpTester(dotPos[1], 'tagName');
      var classNameFilter = wordRegExpTester(dotPos[2], 'className');
      return function(v) {
        return isNode(v) == 1 && nodeNameFilter(v) && classNameFilter(v);
      };
    }
    else if (context)
      return function(v) {
        return $(selector, context)['find'](v)!=_null; // live search instead of node set, for on()
      };
    else {
      $(selector)['each'](function(node) {
        nodeSet[getNodeId(node)] = true;
      });
      return function(v) {
        return nodeSet[getNodeId(v)];
      };
    }
  }
509462
function (selector) {
            var ret, self = this;
            if (self.length > 0) {
                ret = Node.all(selector, self);
            } else {
                ret = new Node();
            }
            ret.__parent = self;
            return ret;
        }
402272
@Override
  public JSType getTypeOfThis() {
    Node root = getRootNode();
    if (isGlobal()) {
      return ObjectType.cast(root.getJSType());
    } else if (NodeUtil.isNonArrowFunction(root)) {
      JSType nodeType = root.getJSType();
      if (nodeType != null && nodeType.isFunctionType()) {
        return nodeType.toMaybeFunctionType().getTypeOfThis();
      } else {
        // Executed when the current scope has not been typechecked.
        return null;
      }
    } else {
      return getParent().getTypeOfThis();
    }
  }
719942
function() {
    var tok = this.expect('block');

    var node = 'indent' == this.peek().type
      ? this.block()
      : this.emptyBlock(tok.line);
    node.type = 'NamedBlock';
    node.name = tok.val.trim();
    node.mode = tok.mode;
    node.line = tok.line;

    return node;
  }
634452
function getElementStyle(element) {
  assertHTMLElement(element);
  return genericPropertyGet(
      Methods.STYLE_GETTER, element, 'style', function(style) {
        return style instanceof CSSStyleDeclaration;
      });
}
31480
function getMarker(node, markerType, parentNode) {
  var id = referenceToId(svgAttr(node, markerType));

  return domQuery('marker#' + id, parentNode || document);
}
270671
function getInstructions (selectors) {
  return selectors.split(' ').reverse().map((selector, step) => {
    const discover = step === 0
    const [type, pseudo] = selector.split(':')

    var validate = null
    var instruction = null

    switch (true) {

      // child: '>'
      case />/.test(type):
        instruction = function checkParent (node) {
          return (validate) => validate(node.parent) && node.parent
        }
        break

      // class: '.'
      case /^\./.test(type):
        const names = type.substr(1).split('.')
        validate = (node) => {
          const nodeClassName = node.attribs.class
          return nodeClassName && names.every((name) => nodeClassName.indexOf(name) > -1)
        }
        instruction = function checkClass (node, root) {
          if (discover) {
            return node.getElementsByClassName(names.join(' '))
          }
          return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)
        }
        break

      // attribute: '[key="value"]'
      case /^\[/.test(type):
        const [attributeKey, attributeValue] = type.replace(/\[|\]|"/g, '').split('=')
        validate = (node) => {
          const hasAttribute = Object.keys(node.attribs).indexOf(attributeKey) > -1
          if (hasAttribute) { // regard optional attributeValue
            if (!attributeValue || (node.attribs[attributeKey] === attributeValue)) {
              return true
            }
          }
          return false
        }
        instruction = function checkAttribute (node, root) {
          if (discover) {
            const NodeList = []
            traverseDescendants([node], (descendant) => {
              if (validate(descendant)) {
                NodeList.push(descendant)
              }
            })
            return NodeList
          }
          return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)
        }
        break

      // id: '#'
      case /^#/.test(type):
        const id = type.substr(1)
        validate = (node) => {
          return node.attribs.id === id
        }
        instruction = function checkId (node, root) {
          if (discover) {
            const NodeList = []
            traverseDescendants([node], (descendant, done) => {
              if (validate(descendant)) {
                NodeList.push(descendant)
                done()
              }
            })
            return NodeList
          }
          return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)
        }
        break

      // universal: '*'
      case /\*/.test(type):
        validate = (node) => true
        instruction = function checkUniversal (node, root) {
          if (discover) {
            const NodeList = []
            traverseDescendants([node], (descendant) => NodeList.push(descendant))
            return NodeList
          }
          return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)
        }
        break

      // tag: '...'
      default:
        validate = (node) => {
          return node.name === type
        }
        instruction = function checkTag (node, root) {
          if (discover) {
            const NodeList = []
            traverseDescendants([node], (descendant) => {
              if (validate(descendant)) {
                NodeList.push(descendant)
              }
            })
            return NodeList
          }
          return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)
        }
    }

    if (!pseudo) {
      return instruction
    }

    const rule = pseudo.match(/-(child|type)\((\d+)\)$/)
    const kind = rule[1]
    const index = parseInt(rule[2], 10) - 1

    const validatePseudo = (node) => {
      if (node) {
        var compareSet = node.parent.childTags
        if (kind === 'type') {
          compareSet = compareSet.filter(validate)
        }
        const nodeIndex = compareSet.findIndex((child) => child === node)
        if (nodeIndex === index) {
          return true
        }
      }
      return false
    }

    return function enhanceInstruction (node) {
      const match = instruction(node)
      if (discover) {
        return match.reduce((NodeList, matchedNode) => {
          if (validatePseudo(matchedNode)) {
            NodeList.push(matchedNode)
          }
          return NodeList
        }, [])
      }
      return validatePseudo(match) && match
    }
  })
}
345165
function getPseudoClass1() {
  const type = NodeType.PseudocType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = [];

  // Skip `:`.
  pos++;

  content.push(getIdent());

  {
    const type = NodeType.ArgumentsType;
    const token = tokens[pos];
    const line = token.ln;
    const column = token.col;

    // Skip `(`.
    pos++;

    const selectorContent = [].concat(
      getSC(),
      getSelectorsGroup(),
      getSC()
    );

    const end = getLastPosition(selectorContent, line, column, 1);
    const args = newNode(type, selectorContent, line, column, end);
    content.push(args);

    // Skip `)`.
    pos++;
  }

  return newNode(type, content, line, column);
}
1079020
function(selector) {

	if( typeof selector == 'string' ) {
		var node = document.querySelectorAll(selector);

		if( node.length == 0 ) {
			return null;
		}

		return new NWTNodeInstance(node[0]);
	} else {
		return new NWTNodeInstance(selector);
	}
}
1085609
function getType(node) {
    const tagLoaders = {
        script: 'javascript',
        style: 'text/css'
    };

    return get(node, 'attrs.type', tagLoaders[node.tag]);
}
1313878
function select(selector) {
    var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;

    var selection = root.querySelectorAll(selector);

    return selection.length ? selection : null;
}
923691
function querySelector(selector) {
    init();
    if (!selector) {
      return tokens;
    }
    var match = selector.match(
      /^\s*([\w_-]*)((\s*\[[\w_-]+\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\])*)\s*(\*?)$/
    );
    if (!match) {
      console.warn(colors.blue('Invalid selector expressions %j.'), selector);
      return;
    }
    var tag = match[1];
    var attributes = [];
    var all = match[9] === '*';
    match[2].replace(/\s*\[([\w_-]+)\s*=\s*("([^\\"]*(\\.)*)*"|'([^\\']*(\\.)*)*'|[^\[\]]*)\]/g,
      function (match, name, value) {
        if (/^['"]/.test(value)) {
          /*jslint evil: true */
          value = new Function('return (' + value + ');')();
        }
        attributes.push({
          name: name,
          value: value
        });
      }
    );
    function check(node) {
      if (!node || !node.attrs) {
        return;
      }
      var flag;
      if (!tag || node.tag === tag) {
        flag = true;
        attributes.every(function (item) {
          if (item.value !== node.attrs[item.name]) {
            flag = false;
          }
          return flag;
        });
      }
      return flag;
    }
    var items;
    function scan(node) {
      if (check(node)) {
        if (items) {
          items.push(node);
        }
        return node;
      }
      var result;
      if (node.nodes) {
        node.nodes.every(function (item) {
          result = scan(item);
          return items || !result;
        });
      }
      return result;
    }
    if (all) {
      items = [];
      scan(tokens);
      return items;
    }
    else {
      return scan(tokens);
    }
  }