Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
bug(locators): escape query in byExactBinding
Browse files Browse the repository at this point in the history
  • Loading branch information
sjelin committed May 18, 2015
1 parent de49969 commit 3cded9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/clientsidescripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ functions.findBindings = function(binding, exactMatch, using, rootSelector) {
if (dataBinding) {
var bindingName = dataBinding.exp || dataBinding[0].exp || dataBinding;
if (exactMatch) {
var matcher = new RegExp('({|\\s|^|\\|)' + binding + '(}|\\s|$|\\|)');
var matcher = new RegExp('({|\\s|^|\\|)' +
/* See http://stackoverflow.com/q/3561711 */
binding.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") +
'(}|\\s|$|\\|)');
if (matcher.test(bindingName)) {
matches.push(bindings[i]);
}
Expand Down
14 changes: 13 additions & 1 deletion website/docgen/inline_tags/code.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
var htmlSpecialCharMap = {
"&": "&",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};

module.exports = function codeTagDef() {
return {
name: 'code',
handler: function(doc, tag, content) {
return '<code ng-non-bindable>' + content + '</code>';
return '<code ng-non-bindable>' +
content.replace(/[&<>"'\/]/g, function (s) {
return htmlSpecialCharMap[s];
}) + '</code>';
},
description: 'Handle inline code tags',
aliases: ['monospace']
Expand Down

1 comment on commit 3cded9b

@juliemr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has broken #2163

Please sign in to comment.