

newElement() is defined in the Global Methods section. The tag names can be of the same format as specified for newElement(). When true is passed in place of makeDumpString then the return array has a special property called dumpStr which can be used to easily identify the array index of any specific node. Return: A tree (as array) containing all the nodes (format is same as it was at the time of passing). appendChildElementTree(obj treeObj alias addChElemTree(obj treeObj It takes element node-tree data via a specially designed array and then appends the tree to the calling node.Var txtnodes = node.prependTextNode( " Hello\nWorld", true)
#KLIB PYTHON CODE#
trim() Returns a new string with whitespaces removed from beginning and end of a string.Ĭopy Code var textnode = node.prependTextNode( " Hello World").
#KLIB PYTHON FREE#
If you find any bug or have any ideas to improve the code please feel free to contact me via email.ĭo you find it useful? Please let me know in the comments.īrief Descriptions of kLib Functions/Properties Version: 1.0.4 I have tested them in Chrome (Win and Android), Firefox (Win and Android), Opera Mobile (Android) and IE10. I intend to work on it whenever I have free time.įollowing is the list of functions provided by kLib. In addition to the general overlay function, kLib includes overlayed (non-blocking) alternatives to the alert, confirm, and prompt function. The overlay creation is very flexible and can be used to create virtually any kind of overlay. kLib contains many such functions to make your life easier.Īpart from the DOM manipulation functions kLib has set of functions to create overlays over any visible HTML element (including the body).

This method allows me to create the whole element tree (of any size) in just one line. [ " hRef=h2#myHeader", " div.blueBorder", Var tree = document.getElementById( " mydiv").addChElemTree( The first alpha versions allowed me to achieve the following result. Towards this goal I started writing kLib. small code as well as easy access and direct control. I wanted to get the best of both worlds i.e. If there is a lot of this kind of operations (which is usually the case) then the second approach makes much sense, because we will not need to parse the DOM tree for the intended element. But it gave me direct access to the span element to add an event handler. The second code achieved the same result but the code was a little longer. Var span = document.createElement( " span") H2.innerHTML = " My Header" // or h2.appendChild(document.createTextNode("My Header")) var p = document.createElement( " p") Var div2 = document.createElement( " div") Var div = document.getElementById( " mydiv")
