Skip to content

Commit 1037cef

Browse files
committed
refactor(render): misc minor fixes
1 parent 09948f4 commit 1037cef

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

modules/angular2/src/render/dom/compiler/property_binding_parser.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {isPresent, isBlank, RegExpWrapper, BaseException, StringWrapper} from 'angular2/src/facade/lang';
1+
import {isPresent, RegExpWrapper} from 'angular2/src/facade/lang';
22
import {MapWrapper} from 'angular2/src/facade/collection';
33

4-
import {Parser, AST, ExpressionWithSource} from 'angular2/change_detection';
4+
import {Parser} from 'angular2/change_detection';
55

66
import {CompileStep} from './compile_step';
77
import {CompileElement} from './compile_element';
@@ -10,16 +10,14 @@ import {CompileControl} from './compile_control';
1010
import {dashCaseToCamelCase} from '../util';
1111
import {setterFactory} from './property_setter_factory';
1212

13-
// Group 1 = "bind"
14-
// Group 2 = "var"
15-
// Group 3 = "on"
16-
// Group 4 = the identifier after "bind", "var", or "on"
13+
// Group 1 = "bind-"
14+
// Group 2 = "var-" or "#"
15+
// Group 3 = "on-"
16+
// Group 4 = the identifier after "bind-", "var-/#", or "on-"
1717
// Group 5 = idenitifer inside square braces
1818
// Group 6 = identifier inside parenthesis
19-
// Group 7 = "#"
20-
// Group 8 = identifier after "#"
2119
var BIND_NAME_REGEXP = RegExpWrapper.create(
22-
'^(?:(?:(?:(bind)|(var)|(on))-(.+))|\\[([^\\]]+)\\]|\\(([^\\)]+)\\)|(#)(.+))$');
20+
'^(?:(?:(?:(bind-)|(var-|#)|(on-))(.+))|\\[([^\\]]+)\\]|\\(([^\\)]+)\\))$');
2321

2422
/**
2523
* Parses the property bindings on a single element.
@@ -46,10 +44,9 @@ export class PropertyBindingParser extends CompileStep {
4644
if (isPresent(bindParts[1])) {
4745
// match: bind-prop
4846
this._bindProperty(bindParts[4], attrValue, current, newAttrs);
49-
} else if (isPresent(bindParts[2]) || isPresent(bindParts[7])) {
47+
} else if (isPresent(bindParts[2])) {
5048
// match: var-name / var-name="iden" / #name / #name="iden"
51-
var identifier = (isPresent(bindParts[4]) && bindParts[4] !== '') ?
52-
bindParts[4] : bindParts[8];
49+
var identifier = bindParts[4];
5350
var value = attrValue == '' ? '\$implicit' : attrValue;
5451
this._bindVariable(identifier, value, current, newAttrs);
5552
} else if (isPresent(bindParts[3])) {

modules/angular2/test/render/dom/shadow_dom_emulation_integration_spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ import {IntegrationTestbed} from './integration_testbed';
3131

3232
export function main() {
3333
describe('ShadowDom integration tests', function() {
34-
var urlResolver, styleUrlResolver, styleInliner, styleHost;
34+
var urlResolver, styleUrlResolver, styleInliner;
3535
var strategies = {
36-
"scoped" : () => new EmulatedScopedShadowDomStrategy(styleInliner, styleUrlResolver, styleHost),
37-
"unscoped" : () => new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, styleHost)
36+
"scoped" : () => new EmulatedScopedShadowDomStrategy(styleInliner, styleUrlResolver, null),
37+
"unscoped" : () => new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, null)
3838
}
3939
if (DOM.supportsNativeShadowDOM()) {
4040
StringMapWrapper.set(strategies, "native", () => new NativeShadowDomStrategy(styleUrlResolver));
@@ -48,7 +48,6 @@ export function main() {
4848
var testbed, renderer, rootEl, compile, strategy;
4949

5050
beforeEach( () => {
51-
styleHost = el('<div></div>');
5251
urlResolver = new UrlResolver();
5352
styleUrlResolver = new StyleUrlResolver(urlResolver);
5453
styleInliner = new StyleInliner(null, styleUrlResolver, urlResolver);

0 commit comments

Comments
 (0)