diff --git a/README.md b/README.md index 1e44f04..ccd141f 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ MDV is designed to as two primitives which could eventually become standardized MDV is mainly concerned with being robust and efficient in interacting with application data and keeping the DOM in sync , but more advanced behaviors can be accomplished via one or both of the following: -* [A Custom Syntax API](https://github.com/Polymer/mdv/blob/master/docs/syntax_api.md) +* [A Binding Delegate API](https://github.com/Polymer/mdv/blob/master/docs/syntax_api.md) * [Expression Syntax](https://github.com/Polymer/mdv/blob/master/docs/expression_syntax.md) ### Advanced Topics diff --git a/benchmark/index.html b/benchmark/index.html index d5080b5..50145f6 100644 --- a/benchmark/index.html +++ b/benchmark/index.html @@ -115,10 +115,10 @@

Binding Density

function changeBenchmark() { benchmark = window[benchmarkSelect.value]; - configSelect.innerHTML = ''; + configSelect.textContent = ''; benchmark.configs.forEach(function(config) { var option = document.createElement('option'); - option.innerHTML = config; + option.textContent = config; configSelect.appendChild(option); }); } @@ -133,8 +133,8 @@

Binding Density

goButton.addEventListener('click', function() { goButton.disabled = true; - goButton.innerHTML = 'Running...'; - ul.innerHTML = ''; + goButton.textContent = 'Running...'; + ul.textContent = ''; var bindingDensities = bindingDensityInput.value.split(',').map(function(val) { return Number(val) / 100; @@ -148,8 +148,8 @@

Binding Density

testTypes.forEach(function(testType, i) { var li = document.createElement('li'); - li.innerHTML = testType; - li.setAttribute('style', 'color: ' + colors[i]); + li.textContent = testType; + li.style.color = colors[i]; ul.appendChild(li); }); @@ -159,12 +159,12 @@

Binding Density

datasets = []; - timesCanvas.setAttribute('height', '400'); - timesCanvas.setAttribute('width', '800'); + timesCanvas.height = 400; + timesCanvas.width = 800; timesCanvas.setAttribute('style', ''); var labels = bindingDensities.map(function(density) { - return (density * 100) + '%'; + return density * 100 + '%'; }); var timesArray = []; @@ -176,32 +176,32 @@

Binding Density

var ctx = timesCanvas.getContext("2d"); new Chart(ctx).Line({ - labels : labels, - datasets : timesArray.map(function(times, i) { + labels: labels, + datasets: timesArray.map(function(times, i) { return { - fillColor : 'rgba(255, 255, 255, 0)', - strokeColor : colors[i], - pointColor : colors[i], - pointStrokeColor : "#fff", - data : times + fillColor: 'rgba(255, 255, 255, 0)', + strokeColor: colors[i], + pointColor: colors[i], + pointStrokeColor: "#fff", + data: times }; }) }, { - bezierCurve : false + bezierCurve: false }); goButton.disabled = false; - goButton.innerHTML = 'Run Benchmarks'; + goButton.textContent = 'Run Benchmarks'; updateStatus(); } function updateStatus(density, testType, runCount) { if (!testType) { - statusSpan.innerHTML = ''; + statusSpan.textContent = ''; return; } - statusSpan.innerHTML = testType + ' ' + (100 * density) + + statusSpan.textContent = testType + ' ' + (100 * density) + '% binding density, ' + runCount + ' runs'; } diff --git a/docs/syntax_api.md b/docs/syntax_api.md index 9484d0c..9b8c207 100644 --- a/docs/syntax_api.md +++ b/docs/syntax_api.md @@ -20,18 +20,12 @@ MDV's native features enables a wide-range of use cases, but (by design) don't a * ... And anything else you'd like. -Enabling these features in MDV is a matter of implementing and registering a Custom Syntax. +Enabling these features in MDV is a matter of implementing and registering a binding delegate. ### Basic usage -```html - -``` - ```JavaScript -HTMLTemplateElement.syntax['MySyntax'] = { +templateElement.bindingDelegate = { getBinding: function(model, path, name, node) { // If this function is defined, the syntax can override // the default binding behavior @@ -44,52 +38,9 @@ HTMLTemplateElement.syntax['MySyntax'] = { } ``` -### Custom Syntax Registration - -A Custom Syntax is an object which contains one or more syntax methods which implement specialized behavior. This object is registered with MDV via the HTMLTemplateElement. The syntax need only implement syntax methods it requires to accomplish its goals. - -```JavaScript -var syntax = { - getBinding: function(model, path, name, node) {}, - getInstanceModel: function(template, model) {} -}; -HTMLTemplateElement.syntax['name'] = syntax; -``` - -### Custom Syntax Usage - -The `