Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 34453003: Rename mdv -> template_binding, remove experiemntal apis from dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index 83555ee93ab689eb610bbd146badae190ea9b3cf..bd703e52a596b31cc64ae4f7c6974b7ad04506cd 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -981,19 +981,6 @@ $endif
}
$if DART2JS
- @Creates('Null') // Set from Dart code; does not instantiate a native type.
-$endif
- Element _templateInstanceRef;
-
- // Note: only used if `this is! TemplateElement`
-$if DART2JS
- @Creates('Null') // Set from Dart code; does not instantiate a native type.
-$endif
- DocumentFragment _templateContent;
-
- bool _templateIsDecorated;
-
-$if DART2JS
@DomName('Element.createShadowRoot')
@SupportedBrowser(SupportedBrowser.CHROME, '25')
@Experimental()
@@ -1010,133 +997,6 @@ $if DART2JS
JS('ShadowRoot|Null', '#.shadowRoot || #.webkitShadowRoot', this, this);
$endif
-
- /**
- * Gets the template this node refers to.
- * This is only supported if [isTemplate] is true.
- */
- @Experimental()
- Element get ref {
- _ensureTemplate();
-
- Element result = null;
- var refId = attributes['ref'];
- if (refId != null) {
- var treeScope = this;
- while (treeScope.parentNode != null) {
- treeScope = treeScope.parentNode;
- }
-
- // Note: JS code tests that getElementById is present. We can't do that
- // easily, so instead check for the types known to implement it.
- if (treeScope is Document ||
- treeScope is ShadowRoot ||
- treeScope is svg.SvgSvgElement) {
-
- result = treeScope.getElementById(refId);
- }
- }
-
- if (result == null) {
- result = _templateInstanceRef;
- if (result == null) return this;
- }
-
- var nextRef = result.ref;
- return nextRef != null ? nextRef : result;
- }
-
- /**
- * Gets the content of this template.
- * This is only supported if [isTemplate] is true.
- */
- @Experimental()
- DocumentFragment get content {
- _ensureTemplate();
- return _templateContent;
- }
-
- /**
- * Creates an instance of the template, using the provided model and optional
- * binding delegate.
- *
- * This is only supported if [isTemplate] is true.
- */
- @Experimental()
- DocumentFragment createInstance(model, [BindingDelegate delegate]) {
- _ensureTemplate();
- return TemplateElement.mdvPackage(this).createInstance(model, delegate);
- }
-
- /**
- * The data model which is inherited through the tree.
- * This is only supported if [isTemplate] is true.
- */
- @Experimental()
- get model => TemplateElement.mdvPackage(this).model;
-
- @Experimental()
- void set model(value) {
- _ensureTemplate();
- TemplateElement.mdvPackage(this).model = value;
- }
-
- /**
- * The binding delegate which is inherited through the tree. It can be used
- * to configure custom syntax for `{{bindings}}` inside this template.
- *
- * This is only supported if [isTemplate] is true.
- */
- @Experimental()
- BindingDelegate get bindingDelegate =>
- TemplateElement.mdvPackage(this).bindingDelegate;
-
- @Experimental()
- void set bindingDelegate(BindingDelegate value) {
- _ensureTemplate();
- TemplateElement.mdvPackage(this).bindingDelegate = value;
- }
-
- // TODO(jmesserly): const set would be better
- static const _TABLE_TAGS = const {
- 'caption': null,
- 'col': null,
- 'colgroup': null,
- 'tbody': null,
- 'td': null,
- 'tfoot': null,
- 'th': null,
- 'thead': null,
- 'tr': null,
- };
-
- bool get _isAttributeTemplate => attributes.containsKey('template') &&
- (localName == 'option' || localName == 'optgroup' ||
- _TABLE_TAGS.containsKey(localName));
-
- /**
- * Returns true if this node is a template.
- *
- * A node is a template if [tagName] is TEMPLATE, or the node has the
- * 'template' attribute and this tag supports attribute form for backwards
- * compatibility with existing HTML parsers. The nodes that can use attribute
- * form are table elments (THEAD, TBODY, TFOOT, TH, TR, TD, CAPTION, COLGROUP
- * and COL), OPTION, and OPTGROUP.
- */
- // TODO(jmesserly): this is not a public MDV API, but it seems like a useful
- // place to document which tags our polyfill considers to be templates.
- // Otherwise I'd be repeating it in several other places.
- // See if we can replace this with a TemplateMixin.
- @Experimental()
- bool get isTemplate => tagName == 'TEMPLATE' || _isAttributeTemplate;
-
- void _ensureTemplate() {
- if (!isTemplate) {
- throw new UnsupportedError('$this is not a template.');
- }
- TemplateElement.decorate(this);
- }
-
/**
* Access this element's content position.
*
« no previous file with comments | « tools/dom/scripts/htmlrenamer.py ('k') | tools/dom/templates/html/impl/impl_HTMLDocument.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698