|
513 | 513 | this._model = null;
|
514 | 514 | this._usedBindings = [];
|
515 | 515 | this.ui = api.create({});
|
| 516 | + this.includeDataProperties = false; |
516 | 517 | }
|
517 | 518 | BindingContext.prototype = {
|
518 |
| - _subContext: function (model, binding, uiPath) { |
| 519 | + _subContext: function (model, binding, uiPath, includeDataProperties) { |
519 | 520 | var result = Object.create(this._root);
|
520 | 521 | result._model = model;
|
521 | 522 | result._usedBindings = [binding];
|
|
527 | 528 | if (result.ui.jsonType() !== 'object') {
|
528 | 529 | result.ui.set('', {});
|
529 | 530 | }
|
| 531 | + result.includeDataProperties = includeDataProperties || this.includeDataProperties; |
530 | 532 | return result;
|
531 | 533 | },
|
532 | 534 | selectBinding: function (model, tag, attrs) {
|
|
583 | 585 | }
|
584 | 586 | data.tag = data.tag || 'span';
|
585 | 587 | data.attrs = data.attrs || {};
|
586 |
| - data.attrs[dataPropertyStoreKey] = data.key; |
587 |
| - data.attrs[dataPropertyPath] = data.path; |
588 |
| - data.attrs[dataPropertyUiPath] = data.ui; |
589 | 588 | data.ui = data.ui || '';
|
590 | 589 | var rootModel = thisContext._dataStore._getRootModel(data.key);
|
591 | 590 | if (!rootModel) {
|
|
594 | 593 | return callback(error, openTag(data.tag, data.attrs) + errorHtml + closeTag(data.tag, data.attrs));
|
595 | 594 | }
|
596 | 595 | var model = rootModel.modelForPath(data.path);
|
597 |
| - data.attrs[dataPropertyState] = rootModel.state; |
| 596 | + if (thisContext.includeDataProperties) { |
| 597 | + data.attrs[dataPropertyStoreKey] = data.key; |
| 598 | + data.attrs[dataPropertyPath] = data.path; |
| 599 | + data.attrs[dataPropertyUiPath] = data.ui; |
| 600 | + data.attrs[dataPropertyState] = rootModel.state; |
| 601 | + } |
598 | 602 | thisContext._renderHtml(model, data.tag, data.attrs, data.ui, callback);
|
599 | 603 | }, callback);
|
600 | 604 | },
|
|
679 | 683 | var oldState = model._root.state;
|
680 | 684 |
|
681 | 685 | var binding = thisContext.selectBinding(model, tag, attrs);
|
682 |
| - var context = thisContext._subContext(model, binding, uiPath); |
| 686 | + var context = thisContext._subContext(model, binding, uiPath, true); |
683 | 687 |
|
684 | 688 | if (element.boundJsonModel) {
|
685 | 689 | if (model === element.boundJsonModel) {
|
|
719 | 723 | }
|
720 | 724 | }
|
721 | 725 |
|
722 |
| - |
723 |
| - |
724 |
| - // TODO: render HTML instead of coercing DOM |
725 |
| - |
726 | 726 | context._renderInnerHtml(model, binding, tag, attrs, function (error, innerHtml) {
|
727 | 727 | console.log('Rendered HTML:', innerHtml);
|
| 728 | + // DEBUG |
| 729 | + innerHtml = '<span class="debug">DOM/HTML render</span>' + innerHtml; |
728 | 730 | element.innerHTML = innerHtml;
|
729 | 731 | htmlReady(error);
|
730 | 732 | });
|
731 |
| - |
732 |
| - /* |
733 |
| - thisContext._updateDom(element, tag, attrs, function (error) { |
734 |
| - binding.bindDom(context, model, element); |
735 |
| - return callback(error); |
736 |
| - }); |
737 |
| - */ |
738 | 733 | });
|
739 | 734 | },
|
740 | 735 | _coerceDom: function coerceDom(subject, target, cullSize, callback) {
|
|
0 commit comments