stoyanmkd

Design Pattern homework

Feb 16th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mod = (function(){
  2.  
  3.     function createContainer(id){
  4.         var container = document.createElement("div");
  5.         var parent = document.getElementById("wrapper");
  6.         container.id = id;
  7.  
  8.         parent.appendChild(container);
  9.     }
  10.  
  11.     function createSection(parent, title){
  12.         var section = document.createElement("div");
  13.         var sectionTitle = document.createElement("h1");
  14.         sectionTitle.innerHTML = title;
  15.         var parent = document.querySelector('#wrapper #' +  parent);
  16.  
  17.         section.appendChild(sectionTitle);
  18.         parent.appendChild(section);
  19.     }
  20.  
  21.     return {
  22.         createContainer : createContainer,
  23.         createSection : createSection,
  24.     }
  25. }());
Advertisement
Add Comment
Please, Sign In to add comment