Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix binding to field in object with slash in key name #3871

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/annotations/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
},

_bindingRegex: (function() {
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-*]*' + ')';
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$\\-\\/*]*' + ')';
var NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
var SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
var DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
Expand Down
4 changes: 4 additions & 0 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
literal1 {{cpnd1}} literal2 {{cpnd2}}{{cpnd3.prop}} literal3 {{computeCompound(cpnd4, cpnd5, 'literal')}} literal4
</div>
<span id="boundWithDash">{{objectWithDash.binding-with-dash}}</span>
<span id="boundWithSlash">{{objectWithSlash.binding/with/slash}}</span>
</template>
<script>
Polymer({
Expand Down Expand Up @@ -138,6 +139,9 @@
},
objectWithDash: {
type: Object
},
objectWithSlash: {
type: Object
}
},
observers: [
Expand Down
7 changes: 7 additions & 0 deletions test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@
assert.equal(el.$.boundWithDash.textContent, 'yes');
});

test('binding with slash', function() {
el.objectWithSlash = {
'binding/with/slash': 'yes'
};
assert.equal(el.$.boundWithSlash.textContent, 'yes');
});

test('class attribute without template scope not erased', function() {
var el = document.querySelector('.class1');
assert.notEqual(el, null, 'class without template scope is undefined');
Expand Down