当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lang.RegExpMatcherWrapper类代码示例

本文整理汇总了TypeScript中angular2/src/facade/lang.RegExpMatcherWrapper的典型用法代码示例。如果您正苦于以下问题:TypeScript RegExpMatcherWrapper类的具体用法?TypeScript RegExpMatcherWrapper怎么用?TypeScript RegExpMatcherWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RegExpMatcherWrapper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _extractUnscopedRulesFromCssText

 _extractUnscopedRulesFromCssText(cssText) {
   var r = '',
       m;
   var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     var rule = m[0];
     rule = StringWrapper.replace(rule, m[2], '');
     rule = StringWrapper.replace(rule, m[1], m[3]);
     r = rule + '\n\n';
   }
   return r;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:12,代码来源:shadow_css.ts

示例2: _extractUnscopedRulesFromCssText

 /*
  * Process styles to add rules which will only apply under the polyfill
  * and do not process via CSSOM. (CSSOM is destructive to rules on rare
  * occasions, e.g. -webkit-calc on Safari.)
  * For example, we convert this rule:
  *
  * @polyfill-unscoped-rule {
  *   content: 'menu-item';
  * ... }
  *
  * to this:
  *
  * menu-item {...}
  *
 **/
 _extractUnscopedRulesFromCssText(cssText: string): string {
   // Difference with webcomponents.js: does not handle comments
   var r = '', m;
   var matcher = RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText);
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     var rule = m[0];
     rule = StringWrapper.replace(rule, m[2], '');
     rule = StringWrapper.replace(rule, m[1], m[3]);
     r = rule + '\n\n';
   }
   return r;
 }
开发者ID:188799958,项目名称:angular,代码行数:27,代码来源:shadow_css.ts

示例3: it

 it('should expose the index for each match', () => {
   var re = RegExpWrapper.create('(!)');
   var matcher = RegExpWrapper.matcher(re, '0!23!567!!');
   var indexes = [];
   var m;
   while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
     ListWrapper.push(indexes, m.index);
     expect(m[0]).toEqual('!');
     expect(m[1]).toEqual('!');
     expect(m.length).toBe(2);
   }
   expect(indexes).toEqual([1, 4, 8, 9]);
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:13,代码来源:lang_spec.ts

示例4: parse

 static parse(selector) {
   var results = ListWrapper.create();
   var _addResult = (res, cssSel) => {
     if (isPresent(cssSel.notSelector) && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
       cssSel.element = "*";
     }
     ListWrapper.push(res, cssSel);
   };
   var cssSelector = new CssSelector();
   var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
   var match;
   var current = cssSelector;
   while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
     if (isPresent(match[1])) {
       if (isPresent(cssSelector.notSelector)) {
         throw new BaseException('Nesting :not is not allowed in a selector');
       }
       current.notSelector = new CssSelector();
       current = current.notSelector;
     }
     if (isPresent(match[2])) {
       current.setElement(match[2]);
     }
     if (isPresent(match[3])) {
       current.addClassName(match[3]);
     }
     if (isPresent(match[4])) {
       current.addAttribute(match[4], match[5]);
     }
     if (isPresent(match[6])) {
       _addResult(results, cssSelector);
       cssSelector = current = new CssSelector();
     }
   }
   _addResult(results, cssSelector);
   return results;
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:37,代码来源:selector.ts


注:本文中的angular2/src/facade/lang.RegExpMatcherWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。