Skip to content

Commit

Permalink
Merge pull request #4768 from Polymer/rewrite-expression-parser
Browse files Browse the repository at this point in the history
Rewrite expression parser to a state machine in optional mixin
  • Loading branch information
TimvdLippe authored Mar 31, 2018
2 parents 55d9175 + 23ba7de commit 569ff37
Show file tree
Hide file tree
Showing 10 changed files with 697 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"devDependencies": {
"web-component-tester": "^6.0.0",
"test-fixture": "PolymerElements/test-fixture#3.0.0-rc.1",
"iron-component-page": "PolymerElements/iron-component-page#^3.0.1"
"iron-component-page": "PolymerElements/iron-component-page#^3.0.1",
"perf-tester": "polymerlabs/perf-tester"
},
"private": true,
"resolutions": {
Expand Down
11 changes: 11 additions & 0 deletions externs/closure-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,17 @@ Polymer_ArraySelectorMixin.prototype.select = function(item){};
Polymer_ArraySelectorMixin.prototype.selectIndex = function(idx){};
/**
* @interface
* @extends {Polymer_PropertyEffects}
*/
function Polymer_StrictBindingParser(){}
/**
* @param {string} text Text to parse from attribute or textContent
* @param {Object} templateInfo Current template metadata
* @return {Array.<!BindingPart>}
*/
Polymer_StrictBindingParser._parseBindings = function(text, templateInfo){};
/**
* @interface
* @extends {Polymer_ElementMixin}
*/
function Polymer_DisableUpgradeMixin(){}
Expand Down
11 changes: 11 additions & 0 deletions lib/mixins/property-effects.html
Original file line number Diff line number Diff line change
Expand Up @@ -2629,6 +2629,17 @@
* - Inline computed method (supports negation):
* `[[compute(a, 'literal', b)]]`, `[[!compute(a, 'literal', b)]]`
*
* The default implementation uses a regular expression for best
* performance. However, the regular expression uses a white-list of
* allowed characters in a data-binding, which causes problems for
* data-bindings that do use characters not in this white-list.
*
* Instead of updating the white-list with all allowed characters,
* there is a StrictBindingParser (see lib/mixins/strict-binding-parser)
* that uses a state machine instead. This state machine is able to handle
* all characters. However, it is slightly less performant, therefore we
* extracted it into a separate optional mixin.
*
* @param {string} text Text to parse from attribute or textContent
* @param {Object} templateInfo Current template metadata
* @return {Array<!BindingPart>} Array of binding part metadata
Expand Down
Loading

0 comments on commit 569ff37

Please sign in to comment.