Skip to content

Commit

Permalink
[#3] Added iterator for DOM nodes & scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevraeka committed Feb 23, 2015
1 parent 3fc1a6b commit 561ba6b
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions src/x-carousel.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,53 @@
xtag.register('x-carousel', {
lifecycle: {
// Fires when an instance of the element is created
created: function() {},
created: function() {
this._items = [];
},

// Fires when an instance was inserted into the document
inserted: function() {},
inserted: function() {
this.loadItems();
this.loadTheme();
},

loadTheme: function(){

},

options: function(){
// TODO: refactor into
if(this.lazyload !== undefined && this.lazyload !== null){
// load items lazy
}
if(this.wrap !== undefined && this.wrap !== null) {
// wrap items
}

// controls
},

loadItems: function(){
if(this.items !== undefined && this.items !== null && this.items !== ""){
// load JSON based on path
}

if(this.childNodes('li').length > 0) {
[].forEach.call(this.querySelectorAll('li'), function (carouselItem) {
this._items.push({"item" : carouselItem, "content" : carouselItem.innerHTML })
}.bind(this));
}
},

// Fires when an instance was removed from the document
removed: function() {},
removed: function() {

},

// Fires when an attribute was added, removed, or updated
attributeChanged: function(attr, oldVal, newVal) {}
attributeChanged: function(attr, oldVal, newVal) {

}
},
events: {},
accessors: {},
Expand Down

0 comments on commit 561ba6b

Please sign in to comment.