本文整理汇总了TypeScript中angular2/src/render/dom/compiler/selector.CssSelector类的典型用法代码示例。如果您正苦于以下问题:TypeScript CssSelector类的具体用法?TypeScript CssSelector怎么用?TypeScript CssSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CssSelector类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should detect multiple attributes', () => {
var cssSelector = CssSelector.parse('input[type=text][control]')[0];
expect(cssSelector.element).toEqual('input');
expect(cssSelector.attrs).toEqual(['type', 'text', 'control', '']);
expect(cssSelector.toString()).toEqual('input[type=text][control]');
});
开发者ID:B-Thapa,项目名称:angular,代码行数:7,代码来源:selector_spec.ts
示例2: parse
function parse() {
var result = [];
for (var i = 0; i < count; i++) {
result.push(CssSelector.parse(fixedSelectorStrings[i]));
}
return result;
}
开发者ID:AsherBarak,项目名称:angular,代码行数:7,代码来源:selector_benchmark.ts
示例3: it
it('should select by class name case insensitive', () => {
matcher.addSelectables(s1 = CssSelector.parse('.someClass'), 1);
matcher.addSelectables(s2 = CssSelector.parse('.someClass.class2'), 2);
expect(matcher.match(CssSelector.parse('.SOMEOTHERCLASS')[0], selectableCollector))
.toEqual(false);
expect(matched).toEqual([]);
expect(matcher.match(CssSelector.parse('.SOMECLASS')[0], selectableCollector)).toEqual(true);
expect(matched).toEqual([s1[0], 1]);
reset();
expect(matcher.match(CssSelector.parse('.someClass.class2')[0], selectableCollector))
.toEqual(true);
expect(matched).toEqual([s1[0], 1, s2[0], 2]);
});
开发者ID:188799958,项目名称:angular,代码行数:16,代码来源:selector_spec.ts
示例4: it
it('should detect lists of selectors', () => {
var cssSelectors = CssSelector.parse('.someclass,[attrname=attrvalue], sometag');
expect(cssSelectors.length).toEqual(3);
expect(cssSelectors[0].classNames).toEqual(['someclass']);
expect(cssSelectors[1].attrs).toEqual(['attrname', 'attrvalue']);
expect(cssSelectors[2].element).toEqual('sometag');
});
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:7,代码来源:selector_spec.ts
示例5: constructor
constructor(parser: Parser, directives:List<DirectiveMetadata>) {
super();
this._parser = parser;
this._selectorMatcher = new SelectorMatcher();
this._directives = directives;
for (var i=0; i<directives.length; i++) {
var selector = CssSelector.parse(directives[i].selector);
this._selectorMatcher.addSelectables(selector, i);
}
}
开发者ID:tavwizard,项目名称:angular,代码行数:10,代码来源:directive_parser.ts
示例6: constructor
constructor(parser: Parser, directives: List<DirectiveMetadata>) {
this._parser = parser;
this._selectorMatcher = new SelectorMatcher();
this._directives = directives;
for (var i = 0; i < directives.length; i++) {
var directive = directives[i];
var selector = CssSelector.parse(directive.selector);
this._ensureComponentOnlyHasElementSelector(selector, directive);
this._selectorMatcher.addSelectables(selector, i);
}
}
开发者ID:baraksu,项目名称:angular,代码行数:11,代码来源:directive_parser.ts
注:本文中的angular2/src/render/dom/compiler/selector.CssSelector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论