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

Side by Side Diff: pkg/custom_element/lib/custom_element.dart

Issue 35683006: fix build due to mdv -> template_binding rename (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/custom_element/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Custom DOM elements. 6 * Custom DOM elements.
7 * 7 *
8 * This library provides access to the Polymer project's 8 * This library provides access to the Polymer project's
9 * [Custom Elements] 9 * [Custom Elements]
10 * (http://www.polymer-project.org/platform/custom-elements.html) 10 * (http://www.polymer-project.org/platform/custom-elements.html)
11 * API, which lets you define your own elements. With custom elements, you 11 * API, which lets you define your own elements. With custom elements, you
12 * associate code with custom tag names, and then use those custom tag names 12 * associate code with custom tag names, and then use those custom tag names
13 * as you would any standard tag. For more information, see the 13 * as you would any standard tag. For more information, see the
14 * [Polymer.dart homepage](https://www.dartlang.org/polymer-dart/) and its 14 * [Polymer.dart homepage](https://www.dartlang.org/polymer-dart/) and its
15 * [custom element example] 15 * [custom element example]
16 * (https://www.dartlang.org/polymer-dart/#custom-elements). 16 * (https://www.dartlang.org/polymer-dart/#custom-elements).
17 */ 17 */
18 library custom_element; 18 library custom_element;
19 19
20 import 'dart:async'; 20 import 'dart:async';
21 import 'dart:html'; 21 import 'dart:html';
22 import 'package:mdv/mdv.dart' as mdv;
23 import 'package:meta/meta.dart'; 22 import 'package:meta/meta.dart';
24 import 'src/custom_tag_name.dart'; 23 import 'src/custom_tag_name.dart';
25 24
26 part 'src/attribute_map.dart'; 25 part 'src/attribute_map.dart';
27 26
28 // TODO(jmesserly): replace with a real custom element polyfill. 27 // TODO(jmesserly): replace with a real custom element polyfill.
29 // This is just something temporary. 28 // This is just something temporary.
30 /** 29 /**
31 * *Warning*: this implementation is a work in progress. It only implements 30 * *Warning*: this implementation is a work in progress. It only implements
32 * the specification partially. 31 * the specification partially.
33 * 32 *
34 * Registers a custom HTML element with [localName] and the associated 33 * Registers a custom HTML element with [localName] and the associated
35 * constructor. This will ensure the element is detected and 34 * constructor. This will ensure the element is detected and
36 * 35 *
37 * See the specification at: 36 * See the specification at:
38 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html> 37 * <https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html>
39 */ 38 */
40 void registerCustomElement(String localName, CustomElement create()) { 39 void registerCustomElement(String localName, CustomElement create()) {
41 if (_customElements == null) { 40 if (_customElements == null) {
42 _customElements = {}; 41 _customElements = {};
43 mdv.instanceCreated.add(initCustomElements);
44 // TODO(jmesserly): use MutationObserver to watch for inserts? 42 // TODO(jmesserly): use MutationObserver to watch for inserts?
45 } 43 }
46 44
47 if (!isCustomTag(localName)) { 45 if (!isCustomTag(localName)) {
48 throw new ArgumentError('$localName is not a valid custom element name, ' 46 throw new ArgumentError('$localName is not a valid custom element name, '
49 'it should have at least one dash and not be a reserved name.'); 47 'it should have at least one dash and not be a reserved name.');
50 } 48 }
51 49
52 if (_customElements.containsKey(localName)) { 50 if (_customElements.containsKey(localName)) {
53 throw new ArgumentError('custom element $localName already registered.'); 51 throw new ArgumentError('custom element $localName already registered.');
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 for (var removed in record.removedNodes) { 645 for (var removed in record.removedNodes) {
648 if (identical(node, removed)) { 646 if (identical(node, removed)) {
649 observer.disconnect(); 647 observer.disconnect();
650 element.removed(); 648 element.removed();
651 return; 649 return;
652 } 650 }
653 } 651 }
654 } 652 }
655 }).observe(element.parentNode, childList: true); 653 }).observe(element.parentNode, childList: true);
656 } 654 }
OLDNEW
« no previous file with comments | « no previous file | pkg/custom_element/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698