diff --git a/modules/angular2/src/render/dom/compiler/selector.ts b/modules/angular2/src/render/dom/compiler/selector.ts index 7f6c20013e..ddba38d9e0 100644 --- a/modules/angular2/src/render/dom/compiler/selector.ts +++ b/modules/angular2/src/render/dom/compiler/selector.ts @@ -285,6 +285,11 @@ export class SelectorMatcher { result; var partialValuesMap = MapWrapper.get(this._attrValuePartialMap, attrName); + if (!StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, + matchedCallback) || + result; + } result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; } diff --git a/modules/angular2/test/render/dom/compiler/selector_spec.ts b/modules/angular2/test/render/dom/compiler/selector_spec.ts index 28ddd24d1c..de046b44bd 100644 --- a/modules/angular2/test/render/dom/compiler/selector_spec.ts +++ b/modules/angular2/test/render/dom/compiler/selector_spec.ts @@ -68,6 +68,24 @@ export function main() { expect(matcher.match(CssSelector.parse('[someAttr][someAttr2]')[0], selectableCollector)) .toEqual(true); expect(matched).toEqual([s1[0], 1, s2[0], 2]); + + reset(); + expect(matcher.match(CssSelector.parse('[someAttr=someValue][someAttr2]')[0], + selectableCollector)) + .toEqual(true); + expect(matched).toEqual([s1[0], 1, s2[0], 2]); + + reset(); + expect(matcher.match(CssSelector.parse('[someAttr2][someAttr=someValue]')[0], + selectableCollector)) + .toEqual(true); + expect(matched).toEqual([s1[0], 1, s2[0], 2]); + + reset(); + expect(matcher.match(CssSelector.parse('[someAttr2=someValue][someAttr]')[0], + selectableCollector)) + .toEqual(true); + expect(matched).toEqual([s1[0], 1, s2[0], 2]); }); it('should select by attr name only once if the value is from the DOM', () => {