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

Unified Diff: sky/specs/elements.md

Issue 923023005: Specs: Make appendChild, prependChild, and setChild return the child; make Dispatcher's unlisten() … (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | sky/specs/events.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/specs/elements.md
diff --git a/sky/specs/elements.md b/sky/specs/elements.md
index b3da48b0698271de58f9ff4895fdaa5a3612b12a..37bb95c4c250106f0724864ca35a517e1ee541fa 100644
--- a/sky/specs/elements.md
+++ b/sky/specs/elements.md
@@ -139,10 +139,11 @@ abstract class ParentNode extends Node {
external void _appendChild(Node node); // O(N) in number of descendants
// node must be Text or Element
- void appendChild(Node node) {
+ Node appendChild(Node node) {
if (node is String)
node = new Text(node);
- _appendChild(node);
+ _appendChild(node);
+ return node;
}
void append(List nodes) {
nodes.forEach(appendChild);
@@ -150,10 +151,11 @@ abstract class ParentNode extends Node {
external void _prependChild(Node node); // O(N) in number of descendants
// node must be Text or Element
- void prependChild(Node node) {
+ Node prependChild(Node node) {
if (node is String)
node = new Text(node);
- _prependChild(node);
+ _prependChild(node);
+ return node;
}
void prepend(List nodes) {
// note: not implemented in terms of _prependChild()
@@ -164,9 +166,10 @@ abstract class ParentNode extends Node {
}
external void removeChildren(); // O(N) in number of descendants
- void setChild(Node node) {
+ Node setChild(Node node) {
removeChildren();
appendChild(node);
+ return node;
}
void setChildren(List nodes) {
removeChildren();
« no previous file with comments | « no previous file | sky/specs/events.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698