From 6b6b03d5cec5be8a9c37045165b3b8bfe39fae18 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Thu, 24 Jul 2014 13:54:03 +1000 Subject: [PATCH 1/5] Using platform.js to get this working on Firefox Had to make some compromises to get this to work, but it runs on Firefox 30 and Chrome 36! \o/ --- components/todo-app/component.html | 101 +------------------- components/todo-item/component.html | 42 +-------- index.html | 139 +++++++++++++++++++++++++++- 3 files changed, 144 insertions(+), 138 deletions(-) diff --git a/components/todo-app/component.html b/components/todo-app/component.html index 1fd5740..424854d 100644 --- a/components/todo-app/component.html +++ b/components/todo-app/component.html @@ -2,100 +2,7 @@ - + @@ -114,7 +21,7 @@

Web Components Todos

this.shadow = this.context.createShadowRoot(); // stamp out our template in the shadow dom - var template = document.querySelector("#template").content.cloneNode(true); + var template = document.querySelector("#todo-app-template").content.cloneNode(true); this.shadow.appendChild(template); // Setup event listener @@ -164,7 +71,7 @@

Web Components Todos

TodoAppController.prototype.renderList = function(){ // Note: renderList() can be significantly optimized. Leaving // as a Todo for now. - + // Get a reference to the todo container within the shadow DOM var todoContainer = this.shadow.querySelector(".todo-container"); var self = this; @@ -210,5 +117,5 @@

Web Components Todos

// Register our todo-item tag with the document document.registerElement('todo-app', {prototype: TodoApp}); - })(document.currentScript.ownerDocument); + })(document); diff --git a/components/todo-item/component.html b/components/todo-item/component.html index a694335..b0d83cc 100644 --- a/components/todo-item/component.html +++ b/components/todo-item/component.html @@ -1,43 +1,7 @@ - + diff --git a/index.html b/index.html index 4aa6df8..3cd08f9 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,8 @@ + + Componentized TODO @@ -12,9 +14,142 @@

Whoops. Your browser doesn't support one or more of the Web Component - features needed to run this demo. Work is underway in Firefox, Safari + features needed to run this demo. Work is underway in Firefox, Safari and (possibly) IE to change that. Chrome 36+ should run this demo fine for now. Maybe next time!

+ + + + - \ No newline at end of file + From 5f54fc595322e613e45e082441baf3c73f803ec5 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Sun, 27 Jul 2014 21:13:25 +1000 Subject: [PATCH 2/5] Able to move the templates back! By using both the real document and the shimmed ownerDocument, this works again! Much closer to the original version :) --- components/todo-app/component.html | 101 ++++++++++++++++++++- components/todo-item/component.html | 44 ++++++++- index.html | 133 ---------------------------- 3 files changed, 137 insertions(+), 141 deletions(-) diff --git a/components/todo-app/component.html b/components/todo-app/component.html index 424854d..2db6b0a 100644 --- a/components/todo-app/component.html +++ b/components/todo-app/component.html @@ -2,12 +2,105 @@ - + diff --git a/components/todo-item/component.html b/components/todo-item/component.html index b0d83cc..e96e1cd 100644 --- a/components/todo-item/component.html +++ b/components/todo-item/component.html @@ -1,11 +1,47 @@ - + diff --git a/index.html b/index.html index 3cd08f9..62ede1b 100644 --- a/index.html +++ b/index.html @@ -18,138 +18,5 @@ and (possibly) IE to change that. Chrome 36+ should run this demo fine for now. Maybe next time!

- - - - From e411da52e3c5379b950875f8a24e331d5df9a35c Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Sun, 27 Jul 2014 21:15:47 +1000 Subject: [PATCH 3/5] whitespace fixes to make the diffs nicer --- components/todo-item/component.html | 72 ++++++++++++++--------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/components/todo-item/component.html b/components/todo-item/component.html index e96e1cd..27a11ec 100644 --- a/components/todo-item/component.html +++ b/components/todo-item/component.html @@ -2,42 +2,42 @@ +

+

+ + + + + diff --git a/components/todo-item/component.html b/components/todo-item/component.html index 7629328..4070f01 100644 --- a/components/todo-item/component.html +++ b/components/todo-item/component.html @@ -116,5 +116,5 @@ // register out todo-item tag with the document document.registerElement('todo-item', {prototype: TodoItem}); -})(document, document._currentScript.ownerDocument); +})(document, (document._currentScript || document.currentScript).ownerDocument); diff --git a/index.html b/index.html index 62ede1b..8a4b808 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,21 @@ - - Componentized TODO +