`.
+
+1. Part of the tag
+
+ ```php
+ echo html('nav title="Navigation" class=main', 'Welcome');
+ ```
+
+2. As an associative array
+
+ ```php
+ echo html('nav', 'Welcome', array('title'=>'Navigation', 'class'=>'main'));
+ ```
+
+3. As a shorthand string
+
+ ```php
+ echo html('nav', 'Welcome', 'title="Navigation" class=main');
+ ```
+
+4. As an property methods
+
+ ```php
+ $nav = html('nav', 'Welcome');
+ $nav->class = 'main';
+ $nav->title = 'Navigation';
+ echo $nav;
+ ```
+
+All of these examples output the same markup:
+```html
+Welcome
+```
+
+###Adding Nested Elements
+
+Any HTML5 container tags (such as ``, ``, or ``) can have child elements. These elements can be strings or other HTML5 element objects.
+
+```php
+$label = html('span', 'Website!');
+$link = html('a', $label);
+$link->href = 'http://example.com';
+echo $link;
+```
+
+Alternatively, use the `addChild` method for any container tag.
+
+```php
+$link = html('a');
+$link->href = 'http://example.com';
+$link->addChild(html('span', 'Website!'));
+echo $link;
+```
+
+Or `appendTo` to target a container to be added to:
+
+```php
+$link = html('a');
+$link->href = 'http://example.com';
+html('span', 'Website!')->appendTo($link);
+echo $link;
+```
+All examples would output:
+
+```html
+
Website!
+```
+
+###CSS Selectors
+
+Tag names can optionally have CSS-style class and id selectors:
+
+```php
+echo html('a#example'); //
+echo html('span.small'); //
+echo html('span.small.label'); //
+echo html('span#example.small.label'); //
+```
+
+##API Documentation
+
+####For self-closing elements (e.g. `
`, `
`)
+
+```php
+html($tag, $attributes=null);
+```
++ `$tag` **{string}** The name of the valid HTML5 element which can contain CSS selectors or short-hand attribute string.
++ `$attributes` **{array | string}** (optional) Collection of element attributes
+
+Returns a `Canteen\HTML5\Node` object.
+
+####Node Methods
+
++ `setAttribute($name, $value)` Set an attribute by name and value.
++ `setAttributes($values)` Set an associative array of name/value pairs.
++ `setData($name, $value)` Set data-* fields on the HTML5 element.
++ `getData($name)` Get the data-* field on the HTML5 element.
++ `appendTo(NodeContainer $container)` Add the element to the end of a container element.
++ `prependTo(NodeContainer $container)` Add the element to the beginning of a container element.
+
+####For container HTML elements (e.g. `
`, `
`)
+
+```php
+html($tag, $contents=null, $attributes=null);
+```
++ `$tag` **{string}** The name of the valid HTML5 element which can contain CSS selectors or short-hand attribute string.
++ `$contents` **{string | Node | NodeContainer}** (optional) The string of the contents of the tag, or another element created by `html()`
++ `$attributes` **{array | string}** (optional) Collection of element attributes
+
+Returns a `Canteen\HTML5\NodeContainer` object.
+
+####NodeContainer Methods (extends `Node`)
+
++ `addChild($node)` Add a `Node` object to the bottom of the collection of nodes
++ `addChildAt($node, $index)` Add a `Node` object at a specific zero-based index
++ `removeChild($node)` Remove a particular node from the container
++ `removeChildAt($index)` Remove a node by zero-based index
++ `removeChildren()` Remove all children from the container
++ `getChildren()` Get the collection of all `Node` objects
++ `getChildAt($index)` Get a `Node` object at a specific index
+
+###Additional Components
+
+####Document
+
+The `Document` object is used for creating a bare-bones HTML5 document.
+
+```php
+Canteen\HTML5\Document($title='', $charset='utf-8', $beautify=false);
+```
++ `$title` **{string}** (optional) The title of the document
++ `$charset` **{string}** (optional) The HTML character set to use
++ `$beautify` **{boolean}** (optional) If the output should be an indented work of art.
+
+Properties
+
++ `head` **{NodeContainer}** The document's `` element
++ `body` **{NodeContainer}** The document's `` element
++ `title` **{NodeContainer}** The document's `
` element
+
+```php
+ use Canteen\HTML5\Document;
+ $doc = new Document('Untitled');
+ $doc->head->addChild(html('script src=main.js'));
+ $doc->body->addChild(html('div#frame'));
+ echo $doc;
+```
+
+####SimpleList
+
+The `SimpleList` for conveniently creating `` and `` elements.
+
+```php
+Canteen\HTML5\SimpleList($elements, $attributes=null, $type="ul");
+```
+
++ `$elements` **{array}** The collection of strings or other HTML elements
++ `$attributes` **{array | string}** (optional) Collection of element attributes
++ `$type` **{string}** (optional) A value of either "ul" or "ol"
+
+####Table
+
+The `Table` object is used for creating `` elements.
+
+```php
+Canteen\HTML5\Table($data, $headers=null, $checkbox=null);
+```
+
++ `$data` **{array}** The collection of associative-arrays with key/value pairs
++ `$headers` **{array}** (optional) The names of the header labels
++ `$checkbox` **{string}** (optional) The name of the key name in the data to replace with a checkbox, for instance "id"
+
+```php
+// Create a sample table with some rows of dummy data
+$table = new Table(
+ array(
+ array('id'=>1, 'first'=>'James', 'last'=>'Smith'),
+ array('id'=>2, 'first'=>'Mary', 'last'=>'Denver'),
+ array('id'=>3, 'first'=>'Charlie', 'last'=>'Rose')
+ ),
+ array('ID', 'First Name', 'Last Name')
+);
+```
+
+##License##
+
+Copyright (c) 2013 Matt Karl and [CloudKid, LLC](http://cloudkid.com)
+
+Released under the MIT License.
\ No newline at end of file
diff --git a/build.properties b/build.properties
new file mode 100644
index 0000000..68ce650
--- /dev/null
+++ b/build.properties
@@ -0,0 +1,10 @@
+source.dir=src
+docs=yuidoc
+docs.config=docs.json
+docs.outdir=docs
+docs.name=Canteen HTML5 API
+docs.description=Create dynamic, valid HTML5 markup with a simple an intuitive PHP API
+docs.logo=
+docs.themedir=../CanteenTheme
+docs.helpers=${docs.themedir}/path.js
+docs.version=1.0.0
diff --git a/build.xml b/build.xml
new file mode 100644
index 0000000..5ae476e
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..8fdb31f
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,31 @@
+{
+ "name": "Canteen/HTML5",
+ "description" : "Create dynamic, valid HTML5 markup with a simple an intuitive PHP API",
+ "version" : "1.0.0",
+ "type": "library",
+ "keywords": ["html5", "markup", "document", "html", "tags"],
+ "license": "MIT",
+ "homepage" : "http://github.com/Canteen/CanteenHTML5",
+ "time": "2013-10-12",
+ "authors": [
+ {
+ "name": "Matt Karl",
+ "email": "matt@mattkarl.com",
+ "homepage": "http://github.com/bigtimebuddy",
+ "role": "Developer"
+ }
+ ],
+ "autoload": {
+ "psr-0": {
+ "Canteen\\HTML5" : "src/"
+ },
+ "files": ["src/Canteen/HTML5/html.php"]
+ },
+ "minimum-stability": "stable",
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/Canteen/CanteenHTML5"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs.json b/docs.json
new file mode 100644
index 0000000..5cd4b23
--- /dev/null
+++ b/docs.json
@@ -0,0 +1,14 @@
+{
+ "name": "${docs.name}",
+ "description": "${docs.description}",
+ "version": "${version}",
+ "logo":"${docs.logo}",
+ "options" : {
+ "linkNatives": true,
+ "attributesEmit": true,
+ "selleck": true,
+ "helpers": ["${docs.helpers}"],
+ "themedir" : "${docs.themedir}",
+ "outdir" : "${docs.outdir}"
+ }
+}
\ No newline at end of file
diff --git a/docs/api.js b/docs/api.js
new file mode 100644
index 0000000..8afa4d9
--- /dev/null
+++ b/docs/api.js
@@ -0,0 +1,30 @@
+YUI.add("yuidoc-meta", function(Y) {
+ Y.YUIDoc = { meta: {
+ "classes": [
+ "Attribute",
+ "Comment",
+ "Document",
+ "HTML5Error",
+ "Node",
+ "NodeContainer",
+ "SimpleList",
+ "Table",
+ "Text",
+ "html"
+ ],
+ "modules": [
+ "Canteen_HTML5",
+ "global"
+ ],
+ "allModules": [
+ {
+ "displayName": "Canteen\\HTML5",
+ "name": "Canteen_HTML5"
+ },
+ {
+ "displayName": "global",
+ "name": "global"
+ }
+ ]
+} };
+});
\ No newline at end of file
diff --git a/docs/assets/css/external-small.png b/docs/assets/css/external-small.png
new file mode 100644
index 0000000..759a1cd
Binary files /dev/null and b/docs/assets/css/external-small.png differ
diff --git a/docs/assets/css/logo.png b/docs/assets/css/logo.png
new file mode 100644
index 0000000..5b06153
Binary files /dev/null and b/docs/assets/css/logo.png differ
diff --git a/docs/assets/css/main.css b/docs/assets/css/main.css
new file mode 100644
index 0000000..15df7ca
--- /dev/null
+++ b/docs/assets/css/main.css
@@ -0,0 +1,849 @@
+/*
+Font sizes for all selectors other than the body are given in percentages,
+with 100% equal to 13px. To calculate a font size percentage, multiply the
+desired size in pixels by 7.6923076923.
+
+Here's a quick lookup table:
+
+10px - 76.923%
+11px - 84.615%
+12px - 92.308%
+13px - 100%
+14px - 107.692%
+15px - 115.385%
+16px - 123.077%
+17px - 130.769%
+18px - 138.462%
+19px - 146.154%
+20px - 153.846%
+*/
+html {
+ background: #e6e6e6;
+ color: #111111;
+ overflow-y: scroll;
+}
+body {
+ font: 13px/1.4 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', 'Bitstream Vera Sans', 'Helvetica', 'Arial', sans-serif;
+ margin: 0;
+ padding: 0;
+}
+/* -- Links ----------------------------------------------------------------- */
+a {
+ color: #356de4;
+ text-decoration: none;
+}
+.hidden {
+ display: none;
+}
+a:hover {
+ text-decoration: underline;
+}
+/* "Jump to Table of Contents" link is shown to assistive tools, but hidden from
+ sight until it's focused. */
+.jump {
+ position: absolute;
+ padding: 3px 6px;
+ left: -99999px;
+ top: 0;
+}
+.jump:focus {
+ left: 40%;
+}
+/* -- Paragraphs ------------------------------------------------------------ */
+p {
+ margin: 1.3em 0;
+}
+dd p,
+td p {
+ margin-bottom: 0;
+}
+dd p:first-child,
+td p:first-child {
+ margin-top: 0;
+}
+/* -- Headings -------------------------------------------------------------- */
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ color: #111111 !important;
+ /*was #f80*/
+
+ font-weight: 100;
+ line-height: 1.1;
+ margin: 1.1em 0 0.5em;
+}
+h1 {
+ font-size: 184.6%;
+ margin: 0;
+}
+h2 {
+ font-size: 153.846%;
+ margin: 0 !important;
+ padding: 1.5em 0 .5em 0;
+ /*border-bottom: 1px solid #c3c3c3 !important;*/
+}
+h3 {
+ font-size: 138.462%;
+ padding: 1.5em 0 .5em 0;
+}
+h4 {
+ border-bottom: 1px solid #DBDFEA;
+ color: #E48A2B;
+ font-size: 115.385%;
+ font-weight: normal;
+ padding: 1em 0 0 0;
+}
+h5,
+h6 {
+ font-size: 107.692%;
+}
+/* -- Code and examples ----------------------------------------------------- */
+code,
+kbd,
+pre,
+samp {
+ font-family: Menlo, Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;
+ font-size: 92.308%;
+ line-height: 1.35;
+}
+p code,
+p kbd,
+p samp {
+ background: #FCFBFA;
+ border: 1px solid #EFEEED;
+ padding: 0 3px;
+}
+a code,
+a kbd,
+a samp,
+pre code,
+pre kbd,
+pre samp,
+table code,
+table kbd,
+table samp,
+.intro code,
+.intro kbd,
+.intro samp,
+.toc code,
+.toc kbd,
+.toc samp {
+ background: none;
+ border: none;
+ padding: 0;
+}
+pre.code,
+pre.terminal,
+pre.cmd {
+ overflow-x: auto;
+ *overflow-x: scroll;
+ padding: 1em;
+}
+pre.code {
+ background: #fff;
+ border: 1px solid #c3c3c3;
+ border-left-width: 5px;
+ line-height: 150%;
+}
+pre.terminal,
+pre.cmd {
+ background: #F0EFFC;
+ border: 1px solid #D0CBFB;
+ border-left: 5px solid #D0CBFB;
+}
+/* Don't reduce the font size of // elements inside
+ blocks. */
+pre code,
+pre kbd,
+pre samp {
+ font-size: 100%;
+}
+/* Used to denote text that shouldn't be selectable, such as line numbers or
+ shell prompts. Guess which browser this doesn't work in. */
+.noselect {
+ -moz-user-select: -moz-none;
+ -khtml-user-select: none;
+ -webkit-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+}
+/* -- Lists ----------------------------------------------------------------- */
+dd {
+ margin: 0.2em 0 0.7em 1em;
+}
+dl {
+ margin: 1em 0;
+}
+dt {
+ font-weight: bold;
+}
+/* -- Tables ---------------------------------------------------------------- */
+caption,
+th {
+ text-align: left;
+}
+table {
+ border-collapse: collapse;
+ width: 100%;
+}
+td,
+th {
+ border: 1px solid #fff;
+ padding: 5px 12px;
+ vertical-align: top;
+}
+td {
+ background: #E6E9F5;
+}
+td dl {
+ margin: 0;
+}
+td dl dl {
+ margin: 1em 0;
+}
+td pre:first-child {
+ margin-top: 0;
+}
+th {
+ background: #D2D7E6;
+ /*#97A0BF*/
+
+ border-bottom: none;
+ border-top: none;
+ color: #000;
+ /*#FFF1D5*/
+
+ font-family: 'Trebuchet MS', sans-serif;
+ font-weight: bold;
+ line-height: 1.3;
+ white-space: nowrap;
+}
+/* -- Layout and Content ---------------------------------------------------- */
+#doc {
+ margin: auto;
+ min-width: 1024px;
+}
+.content {
+ padding: 0 20px 0 25px;
+}
+.sidebar {
+ padding: 0 2em;
+}
+#bd {
+ padding: 7px 0 30px;
+ position: relative;
+ width: 99%;
+}
+/* -- Table of Contents ----------------------------------------------------- */
+/* The #toc id refers to the single global table of contents, while the .toc
+ class refers to generic TOC lists that could be used throughout the page. */
+.toc code,
+.toc kbd,
+.toc samp {
+ font-size: 100%;
+}
+.toc li {
+ font-weight: bold;
+}
+.toc li li {
+ font-weight: normal;
+}
+/* -- Intro and Example Boxes ----------------------------------------------- */
+/*
+.intro, .example { margin-bottom: 2em; }
+.example {
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: 0 0 5px #bfbfbf;
+ -webkit-box-shadow: 0 0 5px #bfbfbf;
+ box-shadow: 0 0 5px #bfbfbf;
+ padding: 1em;
+}
+.intro {
+ background: none repeat scroll 0 0 #F0F1F8; border: 1px solid #D4D8EB; padding: 0 1em;
+}
+*/
+/* -- Other Styles ---------------------------------------------------------- */
+/* These are probably YUI-specific, and should be moved out of Selleck's default
+ theme. */
+.button {
+ border: 1px solid #dadada;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ color: #444;
+ display: inline-block;
+ font-family: Helvetica, Arial, sans-serif;
+ font-size: 92.308%;
+ font-weight: bold;
+ padding: 4px 13px 3px;
+ white-space: nowrap;
+ background: #EFEFEF;
+ /* old browsers */
+
+ background: -moz-linear-gradient(top, #f5f5f5 0%, #efefef 50%, #e5e5e5 51%, #dfdfdf 100%);
+ /* firefox */
+
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(50%, #efefef), color-stop(51%, #e5e5e5), color-stop(100%, #dfdfdf));
+ /* webkit */
+
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#dfdfdf', GradientType=0);
+ /* ie */
+
+}
+.button:hover {
+ border-color: #466899;
+ color: #fff;
+ text-decoration: none;
+ background: #6396D8;
+ /* old browsers */
+
+ background: -moz-linear-gradient(top, #6396d8 0%, #5a83bc 50%, #547ab7 51%, #466899 100%);
+ /* firefox */
+
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6396d8), color-stop(50%, #5a83bc), color-stop(51%, #547ab7), color-stop(100%, #466899));
+ /* webkit */
+
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6396D8', endColorstr='#466899', GradientType=0);
+ /* ie */
+
+}
+.newwindow {
+ text-align: center;
+}
+#hd h1 {
+ font-size: 100%;
+ text-transform: uppercase;
+}
+
+.header .version em {
+ display: block;
+ text-align: right;
+ line-height: 60px;
+ color: #779CC5;
+}
+#classdocs .item {
+ border-bottom: 0; /*1px solid #c3c3c3*/
+ margin: 0 !important;
+ padding: 2em;
+ border-top:1px solid #ddd;
+}
+/*#classdocs .item:nth-child(2n) {
+ background-color: #f3f3f3;
+}*/
+#classdocs h2 {
+ padding-top: 0 !important;
+}
+#classdocs .item .params p,
+#classdocs .item .returns p {
+ display: inline;
+}
+#classdocs .item em code,
+#classdocs .item em.comment {
+ color: green;
+}
+#classdocs .item em.comment a {
+ color: green;
+ text-decoration: underline;
+}
+#classdocs .foundat {
+ font-size: 11px;
+ font-style: normal;
+}
+.attrs .emits {
+ margin-left: 2em;
+ padding: .5em;
+ border-left: 1px dashed #ccc;
+}
+abbr {
+ border-bottom: 1px dashed #ccc;
+ font-size: 80%;
+ cursor: help;
+}
+.prettyprint li.L0,
+.prettyprint li.L1,
+.prettyprint li.L2,
+.prettyprint li.L3,
+.prettyprint li.L5,
+.prettyprint li.L6,
+.prettyprint li.L7,
+.prettyprint li.L8 {
+ list-style: decimal;
+}
+ul li p {
+ margin-top: 0;
+}
+.method .name {
+ font-size: 110%;
+}
+.apidocs .methods .extends .method,
+.apidocs .properties .extends .property,
+.apidocs .attrs .extends .attr,
+.apidocs .events .extends .event {
+ font-weight: bold;
+}
+.apidocs .methods .extends .inherited,
+.apidocs .properties .extends .inherited,
+.apidocs .attrs .extends .inherited,
+.apidocs .events .extends .inherited {
+ font-weight: normal;
+}
+#hd {
+ padding: 0 15px 1px 20px;
+ background-color:#396EA0;
+ margin-bottom:20px;
+}
+#hd img {
+ margin-top:15px;
+}
+/* -- API Docs CSS ---------------------------------------------------------- */
+/*
+This file is organized so that more generic styles are nearer the top, and more
+specific styles are nearer the bottom of the file. This allows us to take full
+advantage of the cascade to avoid redundant style rules. Please respect this
+convention when making changes.
+*/
+/* -- Generic TabView styles ------------------------------------------------ */
+/*
+These styles apply to all API doc tabviews. To change styles only for a
+specific tabview, see the other sections below.
+*/
+.yui3-js-enabled .apidocs .tabview {
+ visibility: hidden;
+ /* Hide until the TabView finishes rendering. */
+
+ _visibility: visible;
+}
+.apidocs .tabview.yui3-tabview-content {
+ visibility: visible;
+}
+.apidocs .tabview .yui3-tabview-panel {
+ background: #fff;
+ padding: 1em;
+ border: 1px solid #c3c3c3 !important;
+}
+/* -- Generic Content Styles ------------------------------------------------ */
+/* Headings */
+h2,
+h3,
+h4,
+h5,
+h6 {
+ border: none;
+ color: #30418C;
+ font-weight: bold;
+ text-decoration: none;
+}
+.link-docs {
+ float: right;
+ font-size: 15px;
+ margin: 4px 4px 6px;
+ padding: 6px 30px 5px;
+}
+.apidocs {
+ zoom: 1;
+}
+/* Generic box styles. */
+.apidocs .box {
+ border: 1px solid;
+ border-radius: 3px;
+ margin: 1em 0;
+ padding: 0 1em;
+}
+/* A flag is a compact, capsule-like indicator of some kind. It's used to
+ indicate private and protected items, item return types, etc. in an
+ attractive and unobtrusive way. */
+.apidocs .flag {
+ background: #999;
+ border-radius: 3px;
+ color: #fff;
+ font-size: 11px;
+ margin: 0 0.5em;
+ padding: 4px 6px;
+ position: relative;
+ top: -2px;
+}
+/* Class/module metadata such as "Uses", "Extends", "Defined in", etc. */
+.apidocs .meta {
+ border: none;
+ border-top: 1px solid #c3c3c3;
+ color: #555;
+ font-size: 11px;
+ padding: 1em 0;
+}
+.apidocs .meta p {
+ margin: 0;
+}
+/* Deprecation warning. */
+.apidocs .box.deprecated,
+.apidocs .flag.deprecated {
+ background: #fdac9f;
+ border: 1px solid #fd7775;
+}
+.apidocs .box.deprecated p {
+ margin: 0.5em 0;
+}
+.apidocs .flag.deprecated {
+ color: #444444;
+}
+/* Module/Class intro description. */
+.apidocs .intro {
+ background: none;
+ border: none;
+ padding: 0 !important;
+}
+/* Loading spinners. */
+#bd.loading .apidocs,
+#api-list.loading .yui3-tabview-panel {
+ background: #ffffff url(../img/spinner.gif) no-repeat center 70px;
+ min-height: 150px;
+}
+#bd.loading .apidocs .content,
+#api-list.loading .yui3-tabview-panel .apis {
+ display: none;
+}
+.apidocs .no-visible-items {
+ color: #666;
+}
+/* Generic inline list. */
+.apidocs ul.inline {
+ display: inline;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+.apidocs ul.inline li {
+ display: inline;
+}
+/* Comma-separated list. */
+.apidocs ul.commas li:after {
+ content: ',';
+}
+.apidocs ul.commas li:last-child:after {
+ content: '';
+}
+/* Keyboard shortcuts. */
+kbd .cmd {
+ font-family: Monaco, Helvetica;
+}
+/* -- Generic Access Level styles ------------------------------------------- */
+.apidocs .item.protected,
+.apidocs .item.private,
+.apidocs .index-item.protected,
+.apidocs .index-item.deprecated,
+.apidocs .index-item.private {
+ display: none;
+}
+.show-deprecated .item.deprecated,
+.show-deprecated .index-item.deprecated,
+.show-protected .item.protected,
+.show-protected .index-item.protected,
+.show-private .item.private,
+.show-private .index-item.private {
+ display: block;
+}
+.hide-inherited .item.inherited,
+.hide-inherited .index-item.inherited {
+ display: none;
+}
+/* -- Generic Item Index styles --------------------------------------------- */
+.apidocs .index h3 {
+ /*border-bottom: 1px solid #efefef;*/
+ color: #444444;
+ margin: 0 0 0.6em;
+ padding-bottom: 2px;
+}
+.apidocs .index .no-visible-items {
+ margin-top: 2em;
+}
+.apidocs .index-list {
+ border-color: #efefef;
+ font-size: 12px;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ -moz-column-count: 4;
+ -moz-column-gap: 10px;
+ -moz-column-width: 170px;
+ -ms-column-count: 4;
+ -ms-column-gap: 10px;
+ -ms-column-width: 170px;
+ -o-column-count: 4;
+ -o-column-gap: 10px;
+ -o-column-width: 170px;
+ -webkit-column-count: 4;
+ -webkit-column-gap: 10px;
+ -webkit-column-width: 170px;
+ column-count: 4;
+ column-gap: 10px;
+ column-width: 170px;
+}
+.apidocs .no-columns .index-list {
+ -moz-column-count: 1;
+ -ms-column-count: 1;
+ -o-column-count: 1;
+ -webkit-column-count: 1;
+ column-count: 1;
+}
+.apidocs .index-item {
+ white-space: nowrap;
+}
+.apidocs .index-item .flag {
+ background: none;
+ border: none;
+ color: #afafaf;
+ display: inline;
+ margin: 0 0 0 0.2em;
+ padding: 0;
+}
+/* -- Generic API item styles ----------------------------------------------- */
+.apidocs .args {
+ display: inline;
+ margin: 0 0.5em;
+}
+.apidocs .flag.chainable {
+ background: #46ca3b;
+}
+.apidocs .flag.protected {
+ background: #9b86fc;
+}
+.apidocs .flag.private {
+ background: #fd6b1b;
+}
+.apidocs .flag.async {
+ background: #356de4;
+}
+.apidocs .flag.required {
+ background: #e60923;
+}
+.apidocs .item {
+ /*border-bottom: 1px solid #efefef;*/
+ margin: 1.5em 0 2em;
+ padding-bottom: 2em;
+}
+.apidocs .item h4,
+.apidocs .item h5,
+.apidocs .item h6 {
+ color: #444444;
+ font-family: inherit;
+ font-size: 100%;
+}
+.apidocs .item .description p,
+.apidocs .item pre.code {
+ margin: 1em 0 0;
+}
+.apidocs .item .meta {
+ background: none;
+ border: none;
+ padding: 0;
+}
+.apidocs .item .name {
+ display: inline;
+ font-size: 16px;
+}
+.apidocs .item .type,
+.apidocs .item .type a,
+.apidocs .returns-inline {
+ color: #555;
+}
+.apidocs .item .type,
+.apidocs .returns-inline {
+ font-size: 11px;
+ margin: 0 0 0 0;
+}
+.apidocs .item .type a {
+ border-bottom: 1px dotted #afafaf;
+}
+.apidocs .item .type a:hover {
+ border: none;
+}
+/* -- Item Parameter List --------------------------------------------------- */
+.apidocs .params-list {
+ list-style: square;
+ margin: 1em 0 0 2em;
+ padding: 0;
+}
+.apidocs .param {
+ margin-bottom: 1em;
+}
+.apidocs .param .type,
+.apidocs .param .type a {
+ color: #666;
+}
+.apidocs .param .type {
+ margin: 0 0 0 0.5em;
+ *margin-left: 0.5em;
+}
+.apidocs .param-name {
+ font-weight: bold;
+}
+/* -- Item "Emits" block ---------------------------------------------------- */
+.apidocs .item .emits {
+ background: #f9f9f9;
+ border-color: #eaeaea;
+}
+/* -- Item "Returns" block -------------------------------------------------- */
+.apidocs .item .returns .type,
+.apidocs .item .returns .type a {
+ font-size: 100%;
+ margin: 0;
+}
+/* -- Class Constructor block ----------------------------------------------- */
+.apidocs .constructor .item {
+ border: none;
+ padding-bottom: 0;
+}
+/* -- File Source View ------------------------------------------------------ */
+.apidocs .file pre.code,
+#doc .apidocs .file pre.prettyprint {
+ background: inherit;
+ border: none;
+ overflow: visible;
+ padding: 0;
+}
+.apidocs .L0,
+.apidocs .L1,
+.apidocs .L2,
+.apidocs .L3,
+.apidocs .L4,
+.apidocs .L5,
+.apidocs .L6,
+.apidocs .L7,
+.apidocs .L8,
+.apidocs .L9 {
+ background: inherit;
+}
+/* -- Submodule List -------------------------------------------------------- */
+.apidocs .module-submodule-description {
+ font-size: 12px;
+ margin: 0.3em 0 1em;
+}
+.apidocs .module-submodule-description p:first-child {
+ margin-top: 0;
+}
+/* -- Sidebar TabView ------------------------------------------------------- */
+#api-tabview {
+ margin-top: 0 /*0.6em;*/
+}
+#api-tabview-filter {
+ padding: 0 0 1em;
+}
+#api-filter {
+ width: 100%;
+ font-size: 16px;
+ border: 1px solid #bebebe;
+ padding: 5px;
+ border-radius: 5px;
+ border-top-width: 2px;
+}
+/* -- Content TabView ------------------------------------------------------- */
+
+/* -- Source File Contents -------------------------------------------------- */
+.prettyprint li.L0,
+.prettyprint li.L1,
+.prettyprint li.L2,
+.prettyprint li.L3,
+.prettyprint li.L5,
+.prettyprint li.L6,
+.prettyprint li.L7,
+.prettyprint li.L8 {
+ list-style: decimal;
+}
+/* -- API options ----------------------------------------------------------- */
+#api-options {
+ font-size: 11px;
+ margin-top: 0.5em;
+ position: absolute;
+ right: 2em;
+}
+/*#api-options label { margin-right: 0.6em; }*/
+/* -- API list -------------------------------------------------------------- */
+#api-list {
+ margin-top: -2em;
+ *zoom: 1;
+}
+#api-modules {
+ /*border-bottom: 1px solid #c3c3c3;*/
+}
+.apis {
+ font-size: 12px;
+ line-height: 1.4;
+ list-style: none;
+ margin: 0;
+ padding: 0.5em 0 0.5em 0.4em;
+}
+.apis a {
+ border: 1px solid transparent;
+ display: block;
+ margin: 0 0 0 -4px;
+ padding: 0.4em;
+ text-decoration: none;
+ _border: none;
+ _display: inline;
+ color: #444444 !important;
+ overflow: hidden;
+}
+.apis a:hover,
+.apis a:focus {
+ background: #444444;
+ color: white !important;
+ color: #444444;
+ outline: none;
+}
+.api-list-item a:hover,
+.api-list-item a:focus {
+ font-weight: bold;
+}
+.apis .message {
+ color: #888;
+}
+.apis .result a {
+ padding: 3px 5px 2px;
+}
+.apis .result .type {
+ right: 4px;
+ top: 7px;
+}
+.api-list-item .yui3-highlight {
+ font-weight: bold;
+}
+/* -- YUI Overrides -------------------------------------------------------------- */
+.yui3-skin-sam .yui3-tab-selected .yui3-tab-label {
+ border: none !important;
+}
+.yui3-skin-sam .yui3-tab-selected {
+ margin-bottom:0 !important;
+}
+.yui3-skin-sam .yui3-tab-label {
+ padding: 1em !important;
+ border: none !important;
+ background: none !important;
+ background-color: #c3c3c3 !important;
+}
+.yui3-skin-sam .yui3-tab-label:hover {
+ background-color: #444444 !important;
+ color: white !important;
+}
+/* Important Library Specifics, find and replace
+ @color-CreateJS: #e7841d;
+ @color-EaselJS: #3399ff;
+ @color-TweenJS: #f12528;
+ @color-SoundJS: #8765d6;
+ @color-PreloadJS: #bb2ee5;
+ @color-Zoe: #00b224;
+ */
+.yui3-skin-sam .yui3-tab-selected .yui3-tab-label,
+.yui3-skin-sam .yui3-tab-selected .yui3-tab-label:focus,
+.yui3-skin-sam .yui3-tab-selected .yui3-tab-label:hover {
+ background: none !important;
+ border: none !important;
+ background-color: #2269AF !important;
+}
+.yui3-skin-sam .yui3-tabview-list {
+ /*border-bottom: 5px solid #3399ff !important;*/
+ border:0 !important;
+}
diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png
new file mode 100644
index 0000000..73a53a6
Binary files /dev/null and b/docs/assets/favicon.png differ
diff --git a/docs/assets/img/spinner.gif b/docs/assets/img/spinner.gif
new file mode 100644
index 0000000..44f96ba
Binary files /dev/null and b/docs/assets/img/spinner.gif differ
diff --git a/docs/assets/index.html b/docs/assets/index.html
new file mode 100644
index 0000000..487fe15
--- /dev/null
+++ b/docs/assets/index.html
@@ -0,0 +1,10 @@
+
+
+
+ Redirector
+
+
+
+ Click here to redirect
+
+
diff --git a/docs/assets/js/api-filter.js b/docs/assets/js/api-filter.js
new file mode 100644
index 0000000..37aefba
--- /dev/null
+++ b/docs/assets/js/api-filter.js
@@ -0,0 +1,52 @@
+YUI.add('api-filter', function (Y) {
+
+Y.APIFilter = Y.Base.create('apiFilter', Y.Base, [Y.AutoCompleteBase], {
+ // -- Initializer ----------------------------------------------------------
+ initializer: function () {
+ this._bindUIACBase();
+ this._syncUIACBase();
+ },
+ getDisplayName: function(name) {
+
+ Y.each(Y.YUIDoc.meta.allModules, function(i) {
+ if (i.name === name && i.displayName) {
+ name = i.displayName;
+ }
+ });
+
+ return name;
+ }
+
+}, {
+ // -- Attributes -----------------------------------------------------------
+ ATTRS: {
+ resultHighlighter: {
+ value: 'phraseMatch'
+ },
+
+ // May be set to "classes" or "modules".
+ queryType: {
+ value: 'classes'
+ },
+
+ source: {
+ valueFn: function() {
+ var self = this;
+ return function(q) {
+ var data = Y.YUIDoc.meta[self.get('queryType')],
+ out = [];
+ Y.each(data, function(v) {
+ if (v.toLowerCase().indexOf(q.toLowerCase()) > -1) {
+ out.push(v);
+ }
+ });
+ return out;
+ };
+ }
+ }
+ }
+});
+
+}, '3.4.0', {requires: [
+ 'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources'
+]});
diff --git a/docs/assets/js/api-list.js b/docs/assets/js/api-list.js
new file mode 100644
index 0000000..88905b5
--- /dev/null
+++ b/docs/assets/js/api-list.js
@@ -0,0 +1,251 @@
+YUI.add('api-list', function (Y) {
+
+var Lang = Y.Lang,
+ YArray = Y.Array,
+
+ APIList = Y.namespace('APIList'),
+
+ classesNode = Y.one('#api-classes'),
+ inputNode = Y.one('#api-filter'),
+ modulesNode = Y.one('#api-modules'),
+ tabviewNode = Y.one('#api-tabview'),
+
+ tabs = APIList.tabs = {},
+
+ filter = APIList.filter = new Y.APIFilter({
+ inputNode : inputNode,
+ maxResults: 1000,
+
+ on: {
+ results: onFilterResults
+ }
+ }),
+
+ search = APIList.search = new Y.APISearch({
+ inputNode : inputNode,
+ maxResults: 100,
+
+ on: {
+ clear : onSearchClear,
+ results: onSearchResults
+ }
+ }),
+
+ tabview = APIList.tabview = new Y.TabView({
+ srcNode : tabviewNode,
+ panelNode: '#api-tabview-panel',
+ render : true,
+
+ on: {
+ selectionChange: onTabSelectionChange
+ }
+ }),
+
+ focusManager = APIList.focusManager = tabviewNode.plug(Y.Plugin.NodeFocusManager, {
+ circular : true,
+ descendants: '#api-filter, .yui3-tab-panel-selected .api-list-item a, .yui3-tab-panel-selected .result a',
+ keys : {next: 'down:40', previous: 'down:38'}
+ }).focusManager,
+
+ LIST_ITEM_TEMPLATE =
+ ' ' +
+ '{displayName} ' +
+ ' ';
+
+// -- Init ---------------------------------------------------------------------
+
+// Duckpunch FocusManager's key event handling to prevent it from handling key
+// events when a modifier is pressed.
+Y.before(function (e, activeDescendant) {
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
+ return new Y.Do.Prevent();
+ }
+}, focusManager, '_focusPrevious', focusManager);
+
+Y.before(function (e, activeDescendant) {
+ if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
+ return new Y.Do.Prevent();
+ }
+}, focusManager, '_focusNext', focusManager);
+
+// Create a mapping of tabs in the tabview so we can refer to them easily later.
+tabview.each(function (tab, index) {
+ var name = tab.get('label').toLowerCase();
+
+ tabs[name] = {
+ index: index,
+ name : name,
+ tab : tab
+ };
+});
+
+// Switch tabs on Ctrl/Cmd-Left/Right arrows.
+tabviewNode.on('key', onTabSwitchKey, 'down:37,39');
+
+// Focus the filter input when the `/` key is pressed.
+Y.one(Y.config.doc).on('key', onSearchKey, 'down:83');
+
+// Keep the Focus Manager up to date.
+inputNode.on('focus', function () {
+ focusManager.set('activeDescendant', inputNode);
+});
+
+// Update all tabview links to resolved URLs.
+tabview.get('panelNode').all('a').each(function (link) {
+ link.setAttribute('href', link.get('href'));
+});
+
+// -- Private Functions --------------------------------------------------------
+function getFilterResultNode() {
+ return filter.get('queryType') === 'classes' ? classesNode : modulesNode;
+}
+
+// -- Event Handlers -----------------------------------------------------------
+function onFilterResults(e) {
+ var frag = Y.one(Y.config.doc.createDocumentFragment()),
+ resultNode = getFilterResultNode(),
+ typePlural = filter.get('queryType'),
+ typeSingular = typePlural === 'classes' ? 'class' : 'module';
+
+ if (e.results.length) {
+ YArray.each(e.results, function (result) {
+ frag.append(Lang.sub(LIST_ITEM_TEMPLATE, {
+ rootPath : APIList.rootPath,
+ displayName : filter.getDisplayName(result.highlighted),
+ name : result.text,
+ typePlural : typePlural,
+ typeSingular: typeSingular
+ }));
+ });
+ } else {
+ frag.append(
+ '' +
+ 'No ' + typePlural + ' found.' +
+ ' '
+ );
+ }
+
+ resultNode.empty(true);
+ resultNode.append(frag);
+
+ focusManager.refresh();
+}
+
+function onSearchClear(e) {
+
+ focusManager.refresh();
+}
+
+function onSearchKey(e) {
+ var target = e.target;
+
+ if (target.test('input,select,textarea')
+ || target.get('isContentEditable')) {
+ return;
+ }
+
+ e.preventDefault();
+
+ inputNode.focus();
+ focusManager.refresh();
+}
+
+function onSearchResults(e) {
+ var frag = Y.one(Y.config.doc.createDocumentFragment());
+
+ if (e.results.length) {
+ YArray.each(e.results, function (result) {
+ frag.append(result.display);
+ });
+ } else {
+ frag.append(
+ '' +
+ 'No results found. Maybe you\'ll have better luck with a ' +
+ 'different query?' +
+ ' '
+ );
+ }
+
+
+ focusManager.refresh();
+}
+
+function onTabSelectionChange(e) {
+ var tab = e.newVal,
+ name = tab.get('label').toLowerCase();
+
+ tabs.selected = {
+ index: tab.get('index'),
+ name : name,
+ tab : tab
+ };
+
+ switch (name) {
+ case 'classes': // fallthru
+ case 'modules':
+ filter.setAttrs({
+ minQueryLength: 0,
+ queryType : name
+ });
+
+ search.set('minQueryLength', -1);
+
+ // Only send a request if this isn't the initially-selected tab.
+ if (e.prevVal) {
+ filter.sendRequest(filter.get('value'));
+ }
+ break;
+
+ case 'everything':
+ filter.set('minQueryLength', -1);
+ search.set('minQueryLength', 1);
+
+ if (search.get('value')) {
+ search.sendRequest(search.get('value'));
+ } else {
+ inputNode.focus();
+ }
+ break;
+
+ default:
+ // WTF? We shouldn't be here!
+ filter.set('minQueryLength', -1);
+ search.set('minQueryLength', -1);
+ }
+
+ if (focusManager) {
+ setTimeout(function () {
+ focusManager.refresh();
+ }, 1);
+ }
+}
+
+function onTabSwitchKey(e) {
+ var currentTabIndex = tabs.selected.index;
+
+ if (!(e.ctrlKey || e.metaKey)) {
+ return;
+ }
+
+ e.preventDefault();
+
+ switch (e.keyCode) {
+ case 37: // left arrow
+ if (currentTabIndex > 0) {
+ tabview.selectChild(currentTabIndex - 1);
+ inputNode.focus();
+ }
+ break;
+
+ case 39: // right arrow
+ if (currentTabIndex < (Y.Object.size(tabs) - 2)) {
+ tabview.selectChild(currentTabIndex + 1);
+ inputNode.focus();
+ }
+ break;
+ }
+}
+
+}, '3.4.0', {requires: [
+ 'api-filter', 'api-search', 'event-key', 'node-focusmanager', 'tabview'
+]});
diff --git a/docs/assets/js/api-search.js b/docs/assets/js/api-search.js
new file mode 100644
index 0000000..175f6a6
--- /dev/null
+++ b/docs/assets/js/api-search.js
@@ -0,0 +1,98 @@
+YUI.add('api-search', function (Y) {
+
+var Lang = Y.Lang,
+ Node = Y.Node,
+ YArray = Y.Array;
+
+Y.APISearch = Y.Base.create('apiSearch', Y.Base, [Y.AutoCompleteBase], {
+ // -- Public Properties ----------------------------------------------------
+ RESULT_TEMPLATE:
+ '' +
+ '' +
+ '{name} ' +
+ '{resultType} ' +
+ '{description}
' +
+ '{class} ' +
+ ' ' +
+ ' ',
+
+ // -- Initializer ----------------------------------------------------------
+ initializer: function () {
+ this._bindUIACBase();
+ this._syncUIACBase();
+ },
+
+ // -- Protected Methods ----------------------------------------------------
+ _apiResultFilter: function (query, results) {
+ // Filter components out of the results.
+ return YArray.filter(results, function (result) {
+ return result.raw.resultType === 'component' ? false : result;
+ });
+ },
+
+ _apiResultFormatter: function (query, results) {
+ return YArray.map(results, function (result) {
+ var raw = Y.merge(result.raw), // create a copy
+ desc = raw.description || '';
+
+ // Convert description to text and truncate it if necessary.
+ desc = Node.create('' + desc + '
').get('text');
+
+ if (desc.length > 65) {
+ desc = Y.Escape.html(desc.substr(0, 65)) + ' …';
+ } else {
+ desc = Y.Escape.html(desc);
+ }
+
+ raw['class'] || (raw['class'] = '');
+ raw.description = desc;
+
+ // Use the highlighted result name.
+ raw.name = result.highlighted;
+
+ return Lang.sub(this.RESULT_TEMPLATE, raw);
+ }, this);
+ },
+
+ _apiTextLocator: function (result) {
+ return result.displayName || result.name;
+ }
+}, {
+ // -- Attributes -----------------------------------------------------------
+ ATTRS: {
+ resultFormatter: {
+ valueFn: function () {
+ return this._apiResultFormatter;
+ }
+ },
+
+ resultFilters: {
+ valueFn: function () {
+ return this._apiResultFilter;
+ }
+ },
+
+ resultHighlighter: {
+ value: 'phraseMatch'
+ },
+
+ resultListLocator: {
+ value: 'data.results'
+ },
+
+ resultTextLocator: {
+ valueFn: function () {
+ return this._apiTextLocator;
+ }
+ },
+
+ source: {
+ value: '/api/v1/search?q={query}&count={maxResults}'
+ }
+ }
+});
+
+}, '3.4.0', {requires: [
+ 'autocomplete-base', 'autocomplete-highlighters', 'autocomplete-sources',
+ 'escape'
+]});
diff --git a/docs/assets/js/apidocs.js b/docs/assets/js/apidocs.js
new file mode 100644
index 0000000..2c94900
--- /dev/null
+++ b/docs/assets/js/apidocs.js
@@ -0,0 +1,365 @@
+YUI().use(
+ 'yuidoc-meta',
+ 'api-list', 'history-hash', 'node-screen', 'node-style', 'pjax',
+function (Y) {
+
+var win = Y.config.win,
+ localStorage = win.localStorage,
+
+ bdNode = Y.one('#bd'),
+
+ pjax,
+ defaultRoute,
+
+ classTabView,
+ selectedTab;
+
+// Kill pjax functionality unless serving over HTTP.
+if (!Y.getLocation().protocol.match(/^https?\:/)) {
+ Y.Router.html5 = false;
+}
+
+// Create the default route with middleware which enables syntax highlighting
+// on the loaded content.
+defaultRoute = Y.Pjax.defaultRoute.concat(function (req, res, next) {
+ prettyPrint();
+ bdNode.removeClass('loading');
+
+ next();
+});
+
+pjax = new Y.Pjax({
+ container : '#docs-main',
+ contentSelector: '#docs-main > .content',
+ linkSelector : '#bd a',
+ titleSelector : '#xhr-title',
+
+ navigateOnHash: true,
+ root : '/',
+ routes : [
+ // -- / ----------------------------------------------------------------
+ {
+ path : '/(index.html)?',
+ callbacks: defaultRoute
+ },
+
+ // -- /classes/* -------------------------------------------------------
+ {
+ path : '/classes/:class.html*',
+ callbacks: [defaultRoute, 'handleClasses']
+ },
+
+ // -- /files/* ---------------------------------------------------------
+ {
+ path : '/files/*file',
+ callbacks: [defaultRoute, 'handleFiles']
+ },
+
+ // -- /modules/* -------------------------------------------------------
+ {
+ path : '/modules/:module.html*',
+ callbacks: defaultRoute
+ }
+ ]
+});
+
+// -- Utility Functions --------------------------------------------------------
+
+pjax.checkVisibility = function (tab) {
+ tab || (tab = selectedTab);
+
+ if (!tab) { return; }
+
+ var panelNode = tab.get('panelNode'),
+ visibleItems;
+
+ // If no items are visible in the tab panel due to the current visibility
+ // settings, display a message to that effect.
+ visibleItems = panelNode.all('.item,.index-item').some(function (itemNode) {
+ if (itemNode.getComputedStyle('display') !== 'none') {
+ return true;
+ }
+ });
+
+ panelNode.all('.no-visible-items').remove();
+
+ if (!visibleItems) {
+ if (Y.one('#index .index-item')) {
+ panelNode.append(
+ '' +
+ '
' +
+ 'Some items are not shown due to the current visibility ' +
+ 'settings. Use the checkboxes at the upper right of this ' +
+ 'page to change the visibility settings.' +
+ '
' +
+ '
'
+ );
+ } else {
+ panelNode.append(
+ '' +
+ '
' +
+ 'This class doesn\'t provide any methods, properties, ' +
+ 'attributes, or events.' +
+ '
' +
+ '
'
+ );
+ }
+ }
+
+ // Hide index sections without any visible items.
+ Y.all('.index-section').each(function (section) {
+ var items = 0,
+ visibleItems = 0;
+
+ section.all('.index-item').each(function (itemNode) {
+ items += 1;
+
+ if (itemNode.getComputedStyle('display') !== 'none') {
+ visibleItems += 1;
+ }
+ });
+
+ section.toggleClass('hidden', !visibleItems);
+ section.toggleClass('no-columns', visibleItems < 4);
+ });
+};
+
+pjax.initClassTabView = function () {
+ if (!Y.all('#classdocs .api-class-tab').size()) {
+ return;
+ }
+
+ if (classTabView) {
+ classTabView.destroy();
+ selectedTab = null;
+ }
+
+ classTabView = new Y.TabView({
+ srcNode: '#classdocs',
+
+ on: {
+ selectionChange: pjax.onTabSelectionChange
+ }
+ });
+
+ pjax.updateTabState();
+ classTabView.render();
+};
+
+pjax.initLineNumbers = function () {
+ var hash = win.location.hash.substring(1),
+ container = pjax.get('container'),
+ hasLines, node;
+
+ // Add ids for each line number in the file source view.
+ container.all('.linenums>li').each(function (lineNode, index) {
+ lineNode.set('id', 'l' + (index + 1));
+ lineNode.addClass('file-line');
+ hasLines = true;
+ });
+
+ // Scroll to the desired line.
+ if (hasLines && /^l\d+$/.test(hash)) {
+ if ((node = container.getById(hash))) {
+ win.scroll(0, node.getY());
+ }
+ }
+};
+
+pjax.initRoot = function () {
+ var terminators = /^(?:classes|files|modules)$/,
+ parts = pjax._getPathRoot().split('/'),
+ root = [],
+ i, len, part;
+
+ for (i = 0, len = parts.length; i < len; i += 1) {
+ part = parts[i];
+
+ if (part.match(terminators)) {
+ // Makes sure the path will end with a "/".
+ root.push('');
+ break;
+ }
+
+ root.push(part);
+ }
+
+ pjax.set('root', root.join('/'));
+};
+
+pjax.updateTabState = function (src) {
+ var hash = win.location.hash.substring(1),
+ defaultTab, node, tab, tabPanel;
+
+ function scrollToNode() {
+ if (node.hasClass('protected')) {
+ Y.one('#api-show-protected').set('checked', true);
+ pjax.updateVisibility();
+ }
+
+ if (node.hasClass('private')) {
+ Y.one('#api-show-private').set('checked', true);
+ pjax.updateVisibility();
+ }
+
+ setTimeout(function () {
+ // For some reason, unless we re-get the node instance here,
+ // getY() always returns 0.
+ var node = Y.one('#classdocs').getById(hash);
+ win.scrollTo(0, node.getY() - 70);
+ }, 1);
+ }
+
+ if (!classTabView) {
+ return;
+ }
+
+ if (src === 'hashchange' && !hash) {
+ defaultTab = 'index';
+ } else {
+ if (localStorage) {
+ defaultTab = localStorage.getItem('tab_' + pjax.getPath()) ||
+ 'index';
+ } else {
+ defaultTab = 'index';
+ }
+ }
+
+ if (hash && (node = Y.one('#classdocs').getById(hash))) {
+ if ((tabPanel = node.ancestor('.api-class-tabpanel', true))) {
+ if ((tab = Y.one('#classdocs .api-class-tab.' + tabPanel.get('id')))) {
+ if (classTabView.get('rendered')) {
+ Y.Widget.getByNode(tab).set('selected', 1);
+ } else {
+ tab.addClass('yui3-tab-selected');
+ }
+ }
+ }
+
+ // Scroll to the desired element if this is a hash URL.
+ if (node) {
+ if (classTabView.get('rendered')) {
+ scrollToNode();
+ } else {
+ classTabView.once('renderedChange', scrollToNode);
+ }
+ }
+ } else {
+ tab = Y.one('#classdocs .api-class-tab.' + defaultTab);
+
+ if (classTabView.get('rendered')) {
+ Y.Widget.getByNode(tab).set('selected', 1);
+ } else {
+ tab.addClass('yui3-tab-selected');
+ }
+ }
+};
+
+pjax.updateVisibility = function () {
+ var container = pjax.get('container');
+
+ container.toggleClass('hide-inherited',
+ !Y.one('#api-show-inherited').get('checked'));
+
+ container.toggleClass('show-deprecated',
+ Y.one('#api-show-deprecated').get('checked'));
+
+ container.toggleClass('show-protected',
+ Y.one('#api-show-protected').get('checked'));
+
+ container.toggleClass('show-private',
+ Y.one('#api-show-private').get('checked'));
+
+ pjax.checkVisibility();
+};
+
+// -- Route Handlers -----------------------------------------------------------
+
+pjax.handleClasses = function (req, res, next) {
+ var status = res.ioResponse.status;
+
+ // Handles success and local filesystem XHRs.
+ if (!status || (status >= 200 && status < 300)) {
+ pjax.initClassTabView();
+ }
+
+ next();
+};
+
+pjax.handleFiles = function (req, res, next) {
+ var status = res.ioResponse.status;
+
+ // Handles success and local filesystem XHRs.
+ if (!status || (status >= 200 && status < 300)) {
+ pjax.initLineNumbers();
+ }
+
+ next();
+};
+
+// -- Event Handlers -----------------------------------------------------------
+
+pjax.onNavigate = function (e) {
+ var hash = e.hash,
+ originTarget = e.originEvent && e.originEvent.target,
+ tab;
+
+ if (hash) {
+ tab = originTarget && originTarget.ancestor('.yui3-tab', true);
+
+ if (hash === win.location.hash) {
+ pjax.updateTabState('hashchange');
+ } else if (!tab) {
+ win.location.hash = hash;
+ }
+
+ e.preventDefault();
+ return;
+ }
+
+ // Only scroll to the top of the page when the URL doesn't have a hash.
+ this.set('scrollToTop', !e.url.match(/#.+$/));
+
+ bdNode.addClass('loading');
+};
+
+pjax.onOptionClick = function (e) {
+ pjax.updateVisibility();
+};
+
+pjax.onTabSelectionChange = function (e) {
+ var tab = e.newVal,
+ tabId = tab.get('contentBox').getAttribute('href').substring(1);
+
+ selectedTab = tab;
+
+ // If switching from a previous tab (i.e., this is not the default tab),
+ // replace the history entry with a hash URL that will cause this tab to
+ // be selected if the user navigates away and then returns using the back
+ // or forward buttons.
+ if (e.prevVal && localStorage) {
+ localStorage.setItem('tab_' + pjax.getPath(), tabId);
+ }
+
+ pjax.checkVisibility(tab);
+};
+
+// -- Init ---------------------------------------------------------------------
+
+pjax.on('navigate', pjax.onNavigate);
+
+pjax.initRoot();
+pjax.upgrade();
+pjax.initClassTabView();
+pjax.initLineNumbers();
+pjax.updateVisibility();
+
+Y.APIList.rootPath = pjax.get('root');
+
+Y.one('#api-options').delegate('click', pjax.onOptionClick, 'input');
+
+Y.on('hashchange', function (e) {
+ pjax.updateTabState('hashchange');
+}, win);
+
+});
diff --git a/docs/assets/js/yui-prettify.js b/docs/assets/js/yui-prettify.js
new file mode 100644
index 0000000..18de864
--- /dev/null
+++ b/docs/assets/js/yui-prettify.js
@@ -0,0 +1,17 @@
+YUI().use('node', function(Y) {
+ var code = Y.all('.prettyprint.linenums');
+ if (code.size()) {
+ code.each(function(c) {
+ var lis = c.all('ol li'),
+ l = 1;
+ lis.each(function(n) {
+ n.prepend(' ');
+ l++;
+ });
+ });
+ var h = location.hash;
+ location.hash = '';
+ h = h.replace('LINE_', 'LINENUM_');
+ location.hash = h;
+ }
+});
diff --git a/docs/assets/vendor/prettify/CHANGES.html b/docs/assets/vendor/prettify/CHANGES.html
new file mode 100644
index 0000000..b50b841
--- /dev/null
+++ b/docs/assets/vendor/prettify/CHANGES.html
@@ -0,0 +1,130 @@
+
+
+
+ Change Log
+
+
+ README
+
+ Known Issues
+
+ Perl formatting is really crappy. Partly because the author is lazy and
+ partly because Perl is
+ hard to parse.
+ On some browsers, <code>
elements with newlines in the text
+ which use CSS to specify white-space:pre
will have the newlines
+ improperly stripped if the element is not attached to the document at the time
+ the stripping is done. Also, on IE 6, all newlines will be stripped from
+ <code>
elements because of the way IE6 produces
+ innerHTML
. Workaround: use <pre>
for code with
+ newlines.
+
+
+ Change Log
+ 29 March 2007
+
+ Added tests for PHP support
+ to address
+ issue 3 .
+ Fixed
+ bug : prettyPrintOne
was not halting. This was not
+ reachable through the normal entry point.
+ Fixed
+ bug : recursing into a script block or PHP tag that was not properly
+ closed would not silently drop the content.
+ (test )
+ Fixed
+ bug : was eating tabs
+ (test )
+ Fixed entity handling so that the caveat
+
+ Caveats: please properly escape less-thans. x<y
+ instead of x<y , and use " instead of
+ " for string delimiters.
+
+ is no longer applicable.
+ Added noisefree's C#
+ patch
+ Added a distribution that has comments and
+ whitespace removed to reduce download size from 45.5kB to 12.8kB.
+
+ 4 Jul 2008
+
+ Added language specific formatters that are triggered by the presence
+ of a lang-<language-file-extension>
+ Fixed bug : python handling of '''string'''
+ Fixed bug: /
in regex [charsets] should not end regex
+
+ 5 Jul 2008
+
+ Defined language extensions for Lisp and Lua
+
+ 14 Jul 2008
+
+ Language handlers for F#, OCAML, SQL
+ Support for nocode
spans to allow embedding of line
+ numbers and code annotations which should not be styled or otherwise
+ affect the tokenization of prettified code.
+ See the issue 22
+ testcase .
+
+ 6 Jan 2009
+
+ Language handlers for Visual Basic, Haskell, CSS, and WikiText
+ Added .mxml extension to the markup style handler for
+ Flex MXML files . See
+ issue 37 .
+ Added .m extension to the C style handler so that Objective
+ C source files properly highlight. See
+ issue 58 .
+ Changed HTML lexer to use the same embedded source mechanism as the
+ wiki language handler, and changed to use the registered
+ CSS handler for STYLE element content.
+
+ 21 May 2009
+
+ Rewrote to improve performance on large files.
+ See benchmarks .
+ Fixed bugs with highlighting of Haskell line comments, Lisp
+ number literals, Lua strings, C preprocessor directives,
+ newlines in Wiki code on Windows, and newlines in IE6.
+
+ 14 August 2009
+
+ Fixed prettifying of <code>
blocks with embedded newlines.
+
+ 3 October 2009
+
+ Fixed prettifying of XML/HTML tags that contain uppercase letters.
+
+ 19 July 2010
+
+ Added support for line numbers. Bug
+ 22
+ Added YAML support. Bug
+ 123
+ Added VHDL support courtesy Le Poussin.
+ IE performance improvements. Bug
+ 102 courtesy jacobly.
+ A variety of markup formatting fixes courtesy smain and thezbyg.
+ Fixed copy and paste in IE[678].
+ Changed output to use  
instead of
+
so that the output works when embedded in XML.
+ Bug
+ 108 .
+
+
+
diff --git a/docs/assets/vendor/prettify/COPYING b/docs/assets/vendor/prettify/COPYING
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/docs/assets/vendor/prettify/COPYING
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/docs/assets/vendor/prettify/README.html b/docs/assets/vendor/prettify/README.html
new file mode 100644
index 0000000..c6fe1a3
--- /dev/null
+++ b/docs/assets/vendor/prettify/README.html
@@ -0,0 +1,203 @@
+
+
+
+
+ Javascript code prettifier
+
+
+
+
+
+
+
+
+
+ Languages : CH
+ Javascript code prettifier
+
+ Setup
+
+ Download a distribution
+ Include the script and stylesheets in your document
+ (you will need to make sure the css and js file are on your server, and
+ adjust the paths in the script and link tag)
+
+<link href="prettify.css" type="text/css" rel="stylesheet" />
+<script type="text/javascript" src="prettify.js"></script>
+ Add onload="prettyPrint()"
to your
+ document's body tag.
+ Modify the stylesheet to get the coloring you prefer
+
+
+ Usage
+ Put code snippets in
+ <pre class="prettyprint">...</pre>
+ or <code class="prettyprint">...</code>
+ and it will automatically be pretty printed.
+
+
+
+ The original
+ Prettier
+
+ class Voila {
+public:
+ // Voila
+ static const string VOILA = "Voila";
+
+ // will not interfere with embedded tags .
+}
+
+ class Voila {
+public:
+ // Voila
+ static const string VOILA = "Voila";
+
+ // will not interfere with embedded tags .
+}
+
+
+ FAQ
+ Which languages does it work for?
+ The comments in prettify.js are authoritative but the lexer
+ should work on a number of languages including C and friends,
+ Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
+ It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
+ and Ruby, but, because of commenting conventions, doesn't work on
+ Smalltalk, or CAML-like languages.
+
+ LISPy languages are supported via an extension:
+ lang-lisp.js
.
+ And similarly for
+ CSS
,
+ Haskell
,
+ Lua
,
+ OCAML, SML, F#
,
+ Visual Basic
,
+ SQL
,
+ Protocol Buffers
, and
+ WikiText
..
+
+
If you'd like to add an extension for your favorite language, please
+ look at src/lang-lisp.js and file an
+ issue including your language extension, and a testcase.
+
+ How do I specify which language my code is in?
+ You don't need to specify the language since prettyprint()
+ will guess. You can specify a language by specifying the language extension
+ along with the prettyprint
class like so:
+ <pre class="prettyprint lang-html ">
+ The lang-* class specifies the language file extensions.
+ File extensions supported by default include
+ "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
+ "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
+ "xhtml", "xml", "xsl".
+</pre>
+
+ It doesn't work on <obfuscated code sample> ?
+ Yes. Prettifying obfuscated code is like putting lipstick on a pig
+ — i.e. outside the scope of this tool.
+
+ Which browsers does it work with?
+ It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
+ Look at the test page to see if it
+ works in your browser.
+
+ What's changed?
+ See the change log
+
+ Why doesn't Prettyprinting of strings work on WordPress?
+ Apparently wordpress does "smart quoting" which changes close quotes.
+ This causes end quotes to not match up with open quotes.
+
This breaks prettifying as well as copying and pasting of code samples.
+ See
+ WordPress's help center for info on how to stop smart quoting of code
+ snippets.
+
+ How do I put line numbers in my code?
+ You can use the linenums
class to turn on line
+ numbering. If your code doesn't start at line number 1, you can
+ add a colon and a line number to the end of that class as in
+ linenums:52
.
+
+
For example
+
<pre class="prettyprint linenums:4 "
+>// This is line 4.
+foo();
+bar();
+baz();
+boo();
+far();
+faz();
+<pre>
+ produces
+// This is line 4.
+foo();
+bar();
+baz();
+boo();
+far();
+faz();
+
+
+ How do I prevent a portion of markup from being marked as code?
+ You can use the nocode
class to identify a span of markup
+ that is not code.
+
<pre class=prettyprint>
+int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
+ Continuation of comment */
+int y = bar();
+</pre>
+produces
+
+int x = foo(); /* This is a comment This is not code
+ Continuation of comment */
+int y = bar();
+
+
+ For a more complete example see the issue22
+ testcase .
+
+ I get an error message "a is not a function" or "opt_whenDone is not a function"
+ If you are calling prettyPrint
via an event handler, wrap it in a function.
+ Instead of doing
+
+ addEventListener('load', prettyPrint, false);
+
+ wrap it in a closure like
+
+ addEventListener('load', function (event) { prettyPrint() }, false);
+
+ so that the browser does not pass an event object to prettyPrint
which
+ will confuse it.
+
+
+
+
+
+
diff --git a/docs/assets/vendor/prettify/prettify-min.css b/docs/assets/vendor/prettify/prettify-min.css
new file mode 100644
index 0000000..d44b3a2
--- /dev/null
+++ b/docs/assets/vendor/prettify/prettify-min.css
@@ -0,0 +1 @@
+.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
\ No newline at end of file
diff --git a/docs/assets/vendor/prettify/prettify-min.js b/docs/assets/vendor/prettify/prettify-min.js
new file mode 100644
index 0000000..4845d05
--- /dev/null
+++ b/docs/assets/vendor/prettify/prettify-min.js
@@ -0,0 +1 @@
+window.PR_SHOULD_USE_CONTINUATION=true;var prettyPrintOne;var prettyPrint;(function(){var O=window;var j=["break,continue,do,else,for,if,return,while"];var v=[j,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var q=[v,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var m=[q,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var y=[q,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var T=[y,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"];var s="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes";var x=[q,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var t="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var J=[j,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var g=[j,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var I=[j,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var B=[m,T,x,t+J,g,I];var f=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;var D="str";var A="kwd";var k="com";var Q="typ";var H="lit";var M="pun";var G="pln";var n="tag";var F="dec";var K="src";var R="atn";var o="atv";var P="nocode";var N="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function l(ab){var af=0;var U=false;var ae=false;for(var X=0,W=ab.length;X122)){if(!(am<65||ai>90)){ah.push([Math.max(65,ai)|32,Math.min(am,90)|32])}if(!(am<97||ai>122)){ah.push([Math.max(97,ai)&~32,Math.min(am,122)&~32])}}}}ah.sort(function(aw,av){return(aw[0]-av[0])||(av[1]-aw[1])});var ak=[];var aq=[];for(var at=0;atau[0]){if(au[1]+1>au[0]){ao.push("-")}ao.push(V(au[1]))}}ao.push("]");return ao.join("")}function Y(an){var al=an.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var aj=al.length;var ap=[];for(var am=0,ao=0;am=2&&ak==="["){al[am]=Z(ai)}else{if(ak!=="\\"){al[am]=ai.replace(/[a-zA-Z]/g,function(aq){var ar=aq.charCodeAt(0);return"["+String.fromCharCode(ar&~32,ar|32)+"]"})}}}}return al.join("")}var ac=[];for(var X=0,W=ab.length;X=0;){U[ae.charAt(ag)]=aa}}var ah=aa[1];var ac=""+ah;if(!ai.hasOwnProperty(ac)){aj.push(ah);ai[ac]=null}}aj.push(/[\0-\uffff]/);X=l(aj)})();var Z=V.length;var Y=function(aj){var ab=aj.sourceCode,aa=aj.basePos;var af=[aa,G];var ah=0;var ap=ab.match(X)||[];var al={};for(var ag=0,at=ap.length;ag=5&&"lang-"===ar.substring(0,5);if(ao&&!(ak&&typeof ak[1]==="string")){ao=false;ar=K}if(!ao){al[ai]=ar}}var ad=ah;ah+=ai.length;if(!ao){af.push(aa+ad,ar)}else{var an=ak[1];var am=ai.indexOf(an);var ae=am+an.length;if(ak[2]){ae=ai.length-ak[2].length;am=ae-an.length}var au=ar.substring(5);C(aa+ad,ai.substring(0,am),Y,af);C(aa+ad+am,an,r(au,an),af);C(aa+ad+ae,ai.substring(ae),Y,af)}}aj.decorations=af};return Y}function i(V){var Y=[],U=[];if(V.tripleQuotedStrings){Y.push([D,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(V.multiLineStrings){Y.push([D,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{Y.push([D,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(V.verbatimStrings){U.push([D,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var ab=V.hashComments;if(ab){if(V.cStyleComments){if(ab>1){Y.push([k,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{Y.push([k,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}U.push([D,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])}else{Y.push([k,/^#[^\r\n]*/,null,"#"])}}if(V.cStyleComments){U.push([k,/^\/\/[^\r\n]*/,null]);U.push([k,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(V.regexLiterals){var aa=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");U.push(["lang-regex",new RegExp("^"+N+"("+aa+")")])}var X=V.types;if(X){U.push([Q,X])}var W=(""+V.keywords).replace(/^ | $/g,"");if(W.length){U.push([A,new RegExp("^(?:"+W.replace(/[\s,]+/g,"|")+")\\b"),null])}Y.push([G,/^\s+/,null," \r\n\t\xA0"]);var Z=/^.[^\s\w\.$@\'\"\`\/\\]*/;U.push([H,/^@[a-z_$][a-z_$@0-9]*/i,null],[Q,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[G,/^[a-z_$][a-z_$@0-9]*/i,null],[H,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[G,/^\\[\s\S]?/,null],[M,Z,null]);return h(Y,U)}var L=i({keywords:B,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function S(W,ah,aa){var V=/(?:^|\s)nocode(?:\s|$)/;var ac=/\r\n?|\n/;var ad=W.ownerDocument;var ag=ad.createElement("li");while(W.firstChild){ag.appendChild(W.firstChild)}var X=[ag];function af(am){switch(am.nodeType){case 1:if(V.test(am.className)){break}if("br"===am.nodeName){ae(am);if(am.parentNode){am.parentNode.removeChild(am)}}else{for(var ao=am.firstChild;ao;ao=ao.nextSibling){af(ao)}}break;case 3:case 4:if(aa){var an=am.nodeValue;var ak=an.match(ac);if(ak){var aj=an.substring(0,ak.index);am.nodeValue=aj;var ai=an.substring(ak.index+ak[0].length);if(ai){var al=am.parentNode;al.insertBefore(ad.createTextNode(ai),am.nextSibling)}ae(am);if(!aj){am.parentNode.removeChild(am)}}}break}}function ae(al){while(!al.nextSibling){al=al.parentNode;if(!al){return}}function aj(am,at){var ar=at?am.cloneNode(false):am;var ap=am.parentNode;if(ap){var aq=aj(ap,1);var ao=am.nextSibling;aq.appendChild(ar);for(var an=ao;an;an=ao){ao=an.nextSibling;aq.appendChild(an)}}return ar}var ai=aj(al.nextSibling,0);for(var ak;(ak=ai.parentNode)&&ak.nodeType===1;){ai=ak}X.push(ai)}for(var Z=0;Z=U){aj+=2}if(Y>=ar){ac+=2}}}finally{if(au){au.style.display=ak}}}var u={};function d(W,X){for(var U=X.length;--U>=0;){var V=X[U];if(!u.hasOwnProperty(V)){u[V]=W}else{if(O.console){console.warn("cannot override language handler %s",V)}}}}function r(V,U){if(!(V&&u.hasOwnProperty(V))){V=/^\s*]*(?:>|$)/],[k,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[M,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^
+ Canteen HTML5 API v${version} API Documentation : Attribute
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Attribute Class
+
+
+
+
+
+
An HTML attribute used on the Node, this is used internally.
+Do not initiate this class directly, use the html()
function
+to create attributes on elements.
+
echo html('a', 'Link', 'class=button href="about.html"');
+
+echo html('a', 'Link')
+ ->setAttribute('class', 'button')
+ ->setAttribute('href', 'about.html');
+
+
+
+
+
+
Constructor
+
+
Attribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Convert the attribute to an HTML tag attribute string
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
String representation of attribute
+
+
+
+
+
+
+
+
+
+
+
+
getName
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the name of this attribute
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's name
+
+
+
+
+
+
+
+
+
+
+
+
getValue
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the value of this attribute
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of attribute
+
+
+
+
+
+
+
+
+
+
+
+
setName
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the name of this attribute, cannot be empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setValue
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the value of this attribute, this cannot be empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
shorthand
+
+
+
+
+
+
+
+ Dictionary
+
+
+
+
+
+
+
+
+
+
+
static
+
+
+
+
+
+
+
+
+
+
Convert a string into an associative array
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ str
+ String
+
+
+
+
+
+
The string, delineated by semicolons, and colons for attributes:values
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Dictionary :
+
+
The collection of attributes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_name
+
String
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
_value
+
String
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/Comment.html b/docs/classes/Comment.html
new file mode 100644
index 0000000..97d12ef
--- /dev/null
+++ b/docs/classes/Comment.html
@@ -0,0 +1,2917 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Comment
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Comment Class
+
+
+
+
+
+
Special node type representing an HTML5 inline comment.
+Do not initiate this class directly, use the html('comment')
function:
+
echo html('comment', 'Hidden HTML comment here');
+
+
+
+
+
+
Constructor
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
addChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add's a child to this NodeContainer. The child to add cannot be null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addChildAt
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+
+
+ index
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add a child at a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean
+
+
+
+
+
+
The child Node to add
+
+
+
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to add child at, 0 is top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getChildAt
+
+
+
+
(
+
+
+
+ [index=0]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a child of this Node container at given
+index. If no index is passed in, getChild()
+will return the child at index zero (0).
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [index=0]
+ Int
+ optional
+
+
+
+
+
+
The index to fetch child Node at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child Node
+
+
+
+
+
+
+
+
+
+
+
+
getChildren
+
+
+
()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns an array of all children attached to this Node container.
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Array :
+
+
The collection of Node objects
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prepareChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Before adding a child, we should do some checking for basic types
+and convert it into a more useable Node object.
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child node
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
removeChild
+
+
+
+
(
+
+
+
+ [childNode=null]
+
+
+
+ )
+
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the first instance of child from this. Once the first instance of the child
+is removed, this function will return. It returns
+true if a child was removed and false if no child
+was removed.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [childNode=null]
+ Node
+ optional
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Boolean :
+
+
If successfully removed
+
+
+
+
+
+
+
+
+
+
+
+
removeChildAt
+
+
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Remove a child as a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to remove child at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
removeChildren
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all children attached to this Node container
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeClose
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close the writing of this container as HTML
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The closing HTML tag element
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_children
+
Array
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The collection of children nodes
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/Document.html b/docs/classes/Document.html
new file mode 100644
index 0000000..3a5508d
--- /dev/null
+++ b/docs/classes/Document.html
@@ -0,0 +1,3321 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Document
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Document Class
+
+
+
+
+
+
Create an HTML document. Basic barebones structure.
+Located in the namespace Canteen\HTML5 .
+
$doc = new HTML5\Document('Untitled');
+$doc->head->addChild(html('script src=main.js'));
+$doc->body->addChild(html('div#frame'));
+echo $doc;
+
+
+
+
+
+
Constructor
+
+
Document
+
+
+
+
(
+
+
+
+ [title='']
+
+
+
+
+
+ [charset='utf-8']
+
+
+
+
+
+ [beautify=false]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [title='']
+ String
+ optional
+
+
+
+
+
+
The title of the document
+
+
+
+
+
+
+
+
+ [charset='utf-8']
+ String
+ optional
+
+
+
+
+
+
The character encoding set of this HTML document
+
+
+
+
+
+
+
+
+ [beautify=false]
+ Boolean
+ optional
+
+
+
+
+
+
If we should add whitespace to the output to make it look nice markup.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
addChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add's a child to this NodeContainer. The child to add cannot be null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addChildAt
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+
+
+ index
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add a child at a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean
+
+
+
+
+
+
The child Node to add
+
+
+
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to add child at, 0 is top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
beautify
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
static
+
+
+
+
+
+
+
+
+
+
Beautifies an HTML string into a human-readable and indented work of art.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ html
+ String
+
+
+
+
+
+
The XML-compatible HTML as a string
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The formatted string
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getChildAt
+
+
+
+
(
+
+
+
+ [index=0]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a child of this Node container at given
+index. If no index is passed in, getChild()
+will return the child at index zero (0).
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [index=0]
+ Int
+ optional
+
+
+
+
+
+
The index to fetch child Node at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child Node
+
+
+
+
+
+
+
+
+
+
+
+
getChildren
+
+
+
()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns an array of all children attached to this Node container.
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Array :
+
+
The collection of Node objects
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prepareChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Before adding a child, we should do some checking for basic types
+and convert it into a more useable Node object.
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child node
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
removeChild
+
+
+
+
(
+
+
+
+ [childNode=null]
+
+
+
+ )
+
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the first instance of child from this. Once the first instance of the child
+is removed, this function will return. It returns
+true if a child was removed and false if no child
+was removed.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [childNode=null]
+ Node
+ optional
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Boolean :
+
+
If successfully removed
+
+
+
+
+
+
+
+
+
+
+
+
removeChildAt
+
+
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Remove a child as a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to remove child at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
removeChildren
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all children attached to this Node container
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeClose
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close the writing of this container as HTML
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The closing HTML tag element
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_children
+
Array
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The collection of children nodes
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
beautify
+
Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
Beautify the output
+
+
+
+
+
+
+
+
+
+
+
+
+
body
+
NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/HTML5Error.html b/docs/classes/HTML5Error.html
new file mode 100644
index 0000000..374a433
--- /dev/null
+++ b/docs/classes/HTML5Error.html
@@ -0,0 +1,963 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : HTML5Error
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
HTML5Error Class
+
+
+
+
+
+
Exceptions with using the HTML5 API.
+
try
+{
+ html('invalid', 'something');
+}
+catch(Canteen\HTML5\HTML5Error $e)
+{
+ $e->getMessage();
+}
+
+
+
+
+
+
Constructor
+
+
HTML5Error
+
+
+
+
(
+
+
+
+ code
+
+
+
+
+
+ [data='']
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ code
+ Int
+
+
+
+
+
+
The code of the error
+
+
+
+
+
+
+
+
+ [data='']
+ String
+ optional
+
+
+
+
+
+
Additional data to associate with this error
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
EMPTY_ATTRIBUTE_NAME
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The database connection failed
+
+
+
+
+
+
+
+
+
+
+
+
+
EMPTY_ATTRIBUTE_VALUE
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The alias for a database is invalid
+
+
+
+
+
+
+
+
+
+
+
+
+
EMPTY_CHILD
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The child node is empty
+
+
+
+
+
+
+
+
+
+
+
+
+
EMPTY_NODE_TAG
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
When trying to create a node, the name is empty
+
+
+
+
+
+
+
+
+
+
+
+
+
EMPTY_PARENT
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The parent cannot be empty
+
+
+
+
+
+
+
+
+
+
+
+
+
INVALID_GETTER
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The mysql where trying to execute was a problem
+
+
+
+
+
+
+
+
+
+
+
+
+
INVALID_NODE
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The node is not of instance type Node
+
+
+
+
+
+
+
+
+
+
+
+
+
INVALID_SETTER
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The database name we're trying to switch to is invalid
+
+
+
+
+
+
+
+
+
+
+
+
+
INVALID_TAG
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The html tag name is invalid
+
+
+
+
+
+
+
+
+
+
+
+
+
messages
+
Dictionary
+
+
+
+
+
private
+
+
+
+
+
+
static
+
+
+
+
+
+
Look-up for error messages
+
+
+
+
+
+
+
+
+
+
+
+
+
OUT_OF_BOUNDS
+
Int
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
THe addChildAt is out of bounds
+
+
+
+
+
+
+
+
+
+
+
+
+
UNKNOWN
+
String
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The label for an error that is unknown or unfound in messages
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/Node.html b/docs/classes/Node.html
new file mode 100644
index 0000000..4fb9b2f
--- /dev/null
+++ b/docs/classes/Node.html
@@ -0,0 +1,2069 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Node
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Node Class
+
+
+
+
+
+
A generic html tag with any children or closing tag. (e.g., img, br, hr).
+Do not initiate this class directly, use the html()
function:
+
echo html('br');
+
+
+
+
+
+
Constructor
+
+
Node
+
+
+
+
(
+
+
+
+ [tag=null]
+
+
+
+
+
+ [attributes=null]
+
+
+
+
+
+ [validAttrs=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [tag=null]
+ String
+ optional
+
+
+
+
+
+
The name of the tag
+
+
+
+
+
+
+
+
+ [attributes=null]
+ Array | String
+ optional
+
+
+
+
+
+
The collection of tag attributes
+
+
+
+
+
+
+
+
+ [validAttrs=null]
+ String
+ optional
+
+
+
+
+
+
The list of non-global valid attributes for the tag, comma separated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
GLOBAL_ATTRS
+
String
+
+
+
+
+
+
+
final
+
+
+
+
static
+
+
+
+
+
+
The default valid attributes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/NodeContainer.html b/docs/classes/NodeContainer.html
new file mode 100644
index 0000000..cc48db5
--- /dev/null
+++ b/docs/classes/NodeContainer.html
@@ -0,0 +1,2997 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
NodeContainer Class
+
+
+
+
+
+
Represents an HTML that that can contain other tags (e.g., br, p, div).
+Do not initiate this class directly, use the html()
function:
+
$div = html('div');
+
+
+
+
+
+
Constructor
+
+
NodeContainer
+
+
+
+
(
+
+
+
+ [tag=null]
+
+
+
+
+
+ [children=null]
+
+
+
+
+
+ [attributes=null]
+
+
+
+
+
+ [validAttrs=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [tag=null]
+ String
+ optional
+
+
+
+
+
+
The name of the tag element
+
+
+
+
+
+
+
+
+ [children=null]
+ Node | Array
+ optional
+
+
+
+
+
+
The collection of children or single child
+
+
+
+
+
+
+
+
+ [attributes=null]
+ String | Dictionary
+ optional
+
+
+
+
+
+
+
+
+
+
+
+ [validAttrs=null]
+ String
+ optional
+
+
+
+
+
+
Valid attributes specific to the HTML5 element, comma separated
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
addChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add's a child to this NodeContainer. The child to add cannot be null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addChildAt
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+
+
+ index
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add a child at a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean
+
+
+
+
+
+
The child Node to add
+
+
+
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to add child at, 0 is top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getChildAt
+
+
+
+
(
+
+
+
+ [index=0]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a child of this Node container at given
+index. If no index is passed in, getChild()
+will return the child at index zero (0).
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [index=0]
+ Int
+ optional
+
+
+
+
+
+
The index to fetch child Node at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child Node
+
+
+
+
+
+
+
+
+
+
+
+
getChildren
+
+
+
()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns an array of all children attached to this Node container.
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Array :
+
+
The collection of Node objects
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prepareChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Before adding a child, we should do some checking for basic types
+and convert it into a more useable Node object.
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child node
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
removeChild
+
+
+
+
(
+
+
+
+ [childNode=null]
+
+
+
+ )
+
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the first instance of child from this. Once the first instance of the child
+is removed, this function will return. It returns
+true if a child was removed and false if no child
+was removed.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [childNode=null]
+ Node
+ optional
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Boolean :
+
+
If successfully removed
+
+
+
+
+
+
+
+
+
+
+
+
removeChildAt
+
+
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Remove a child as a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to remove child at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
removeChildren
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all children attached to this Node container
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeClose
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close the writing of this container as HTML
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The closing HTML tag element
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_children
+
Array
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The collection of children nodes
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/SimpleList.html b/docs/classes/SimpleList.html
new file mode 100644
index 0000000..1f23cb4
--- /dev/null
+++ b/docs/classes/SimpleList.html
@@ -0,0 +1,2974 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : SimpleList
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
SimpleList Class
+
+
+
+
+
+
Convenience class for creating an ordered or un-ordered list.
+
$list = new Canteen\HTML5\SimpleList(
+ array(
+ html('b', 'first'),
+ 'second',
+ 'third',
+ array(
+ 'sub-third',
+ 'sub-forth'
+ )
+ )
+);
+
+
+
+
+
+
Constructor
+
+
SimpleList
+
+
+
+
(
+
+
+
+ [elements=null]
+
+
+
+
+
+ [attributes=null]
+
+
+
+
+
+ [type='ul']
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [elements=null]
+ Array
+ optional
+
+
+
+
+
+
The array of child Nodes, Strings, etc.
+
+
+
+
+
+
+
+
+ [attributes=null]
+ String | Dictionary
+ optional
+
+
+
+
+
+
The optional attributes
+
+
+
+
+
+
+
+
+ [type='ul']
+ String
+ optional
+
+
+
+
+
+
The type of list, either ul or ol
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
addChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add's a child to this NodeContainer. The child to add cannot be null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addChildAt
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+
+
+ index
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add a child at a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean
+
+
+
+
+
+
The child Node to add
+
+
+
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to add child at, 0 is top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getChildAt
+
+
+
+
(
+
+
+
+ [index=0]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a child of this Node container at given
+index. If no index is passed in, getChild()
+will return the child at index zero (0).
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [index=0]
+ Int
+ optional
+
+
+
+
+
+
The index to fetch child Node at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child Node
+
+
+
+
+
+
+
+
+
+
+
+
getChildren
+
+
+
()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns an array of all children attached to this Node container.
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Array :
+
+
The collection of Node objects
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prepareChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Override for the prepareChild method on NodeContainer which
+wraps each elements in a list item
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean | Array
+
+
+
+
+
+
The child node to add, an array will get converted into another list elements.
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child node
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
removeChild
+
+
+
+
(
+
+
+
+ [childNode=null]
+
+
+
+ )
+
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the first instance of child from this. Once the first instance of the child
+is removed, this function will return. It returns
+true if a child was removed and false if no child
+was removed.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [childNode=null]
+ Node
+ optional
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Boolean :
+
+
If successfully removed
+
+
+
+
+
+
+
+
+
+
+
+
removeChildAt
+
+
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Remove a child as a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to remove child at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
removeChildren
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all children attached to this Node container
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeClose
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close the writing of this container as HTML
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The closing HTML tag element
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_children
+
Array
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The collection of children nodes
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/Table.html b/docs/classes/Table.html
new file mode 100644
index 0000000..661c4dd
--- /dev/null
+++ b/docs/classes/Table.html
@@ -0,0 +1,2973 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Table
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Table Class
+
+
+
+
+
+
Convenience class for building a Table. Useful for display
+rows of data from a database or another collection
+of associative arrays.
+
$table = new Canteen\HTML5\Table(
+ array(
+ array('id'=>1, 'first'=>'James', 'last'=>'Smith'),
+ array('id'=>2, 'first'=>'Mary', 'last'=>'Denver'),
+ array('id'=>3, 'first'=>'Charlie', 'last'=>'Rose')
+ ),
+ array('ID', 'First Name', 'Last Name')
+);
+
+
+
+
+
+
Constructor
+
+
Table
+
+
+
+
(
+
+
+
+ data
+
+
+
+
+
+ [headers=null]
+
+
+
+
+
+ [checkbox=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ data
+ Array
+
+
+
+
+
+
The collection of Dictionary objects
+
+
+
+
+
+
+
+
+ [headers=null]
+ Array
+ optional
+
+
+
+
+
+
An optional collection of header labels for each value
+
+
+
+
+
+
+
+
+ [checkbox=null]
+ String
+ optional
+
+
+
+
+
+
If we should add a checkbox to each row, this is the name
+ of the attribute to use as a value. For instance array('id'=>2)
is
+ <input type="checkbox" name="id[]" value="2">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
addChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add's a child to this NodeContainer. The child to add cannot be null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
addChildAt
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+
+
+ index
+
+
+
+ )
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add a child at a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ childNode
+ Node | String | Number | Boolean
+
+
+
+
+
+
The child Node to add
+
+
+
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to add child at, 0 is top
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getChildAt
+
+
+
+
(
+
+
+
+ [index=0]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Gets a child of this Node container at given
+index. If no index is passed in, getChild()
+will return the child at index zero (0).
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [index=0]
+ Int
+ optional
+
+
+
+
+
+
The index to fetch child Node at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child Node
+
+
+
+
+
+
+
+
+
+
+
+
getChildren
+
+
+
()
+
+
+
+
+ Array
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns an array of all children attached to this Node container.
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Array :
+
+
The collection of Node objects
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prepareChild
+
+
+
+
(
+
+
+
+ childNode
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Before adding a child, we should do some checking for basic types
+and convert it into a more useable Node object.
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The child node
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
removeChild
+
+
+
+
(
+
+
+
+ [childNode=null]
+
+
+
+ )
+
+
+
+
+
+ Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes the first instance of child from this. Once the first instance of the child
+is removed, this function will return. It returns
+true if a child was removed and false if no child
+was removed.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [childNode=null]
+ Node
+ optional
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Boolean :
+
+
If successfully removed
+
+
+
+
+
+
+
+
+
+
+
+
removeChildAt
+
+
+
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Remove a child as a specific index
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ index
+ Int
+
+
+
+
+
+
The index to remove child at
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
removeChildren
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Removes all children attached to this Node container
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
NodeContainer :
+
+
The instance of the node container
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeClose
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close the writing of this container as HTML
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The closing HTML tag element
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_children
+
Array
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
The collection of children nodes
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/Text.html b/docs/classes/Text.html
new file mode 100644
index 0000000..3c44e1b
--- /dev/null
+++ b/docs/classes/Text.html
@@ -0,0 +1,1956 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Text
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Text Class
+
+
+
+
+
+
Special Node representing plain text. Do not initiate this
+class directly, it is created whenever a text is passed into
+a container tag:
+
echo html('p', 'Some Text Here');
+
+
+
+
+
+
Constructor
+
+
Text
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ text
+ String
+
+
+
+
+
+
the plain text string
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Methods
+
+
+
+
__get
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose getter to get attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the property to set
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__isset
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
See if a property exists
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__set
+
+
+
+
(
+
+
+
+ name
+
+
+
+
+
+ value
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General purpose setter to set attribute values
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the attribute
+
+
+
+
+
+
+
+
+ value
+ String
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
__toString
+
+
+
()
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The string representation of this HTML node
+
+
+
+
+
+
+
+
+
+
+
+
appendTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to a node container at the end
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to add to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
getAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fetch and attribute by name from this Node. The attribute
+name cannot be null; if so, this function will throw an
+Exception.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to fetch
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The attribute's value, if any or null
+
+
+
+
+
+
+
+
+
+
+
+
getData
+
+
+
+
+
+
+
+ String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Get the data-* HTML5 attribute value, if set
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ name
+ String
+
+
+
+
+
+
The name of the data attribute
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The value of the data
+
+
+
+
+
+
+
+
+
+
+
+
getParent
+
+
+
()
+
+
+
+
+ NodeContainer
+
+
+
+
+
+
+
private
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns the parent node of this node, if
+a parent exists. If no parent exists,
+this function returns null.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isEmpty
+
+
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Checks if a variable is really "empty". Code borrowed from PHP.net at
+http://us3.php.net/manual/en/function.empty.php#90767 because we were
+previously using empty() to see if a variable is empty or not. But
+empty() dosen't work for attributes that have a value of "0", so we need
+something more robust here.
+
+an unset variable -> empty
+null -> empty
+0 -> NOT empty
+"0" -> NOT empty
+false -> empty
+true -> NOT empty
+'string value' -> NOT empty
+" "(white space) -> empty
+array()(empty array) -> empty
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ var
+ Mixed
+
+
+
+
+
+
The variable to check for empty on
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
prependTo
+
+
+
+
(
+
+
+
+ container
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Add this child to the beginning of a node container
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ container
+ NodeContainer
+
+
+
+
+
+
The node container to prepend to to
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setAttribute
+
+
+
+
(
+
+
+
+ [name=null]
+
+
+
+
+
+ [value=null]
+
+
+
+
+
+ The
+
+
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Given a name and value pair, sets an attribute on this Node.
+The name and value cannot be empty; if so, this function
+will throw an Exception. Note if the attribute already exists
+and the caller wants to set an attribute of the same name,
+this function will not create a new Attribute, but rather
+update the value of the existing named attribute.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [name=null]
+ String
+ optional
+
+
+
+
+
+
The name of the attribute to add
+
+
+
+
+
+
+
+
+ [value=null]
+ String
+ optional
+
+
+
+
+
+
The value of the attribute
+
+
+
+
+
+
+
+
+ The
+ Node
+
+
+
+
+
+
instance of this node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
setAttributes
+
+
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Set the list of all attributes.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ values
+ Dictionary
+
+
+
+
+
+
An attributes array(name=>value, name=>value)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
The instance of this Node
+
+
+
+
+
+
+
+
+
+
+
+
setParent
+
+
+
+
(
+
+
+
+ [parent=null]
+
+
+
+ )
+
+
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sets the parent of this Node. Note that this
+function is protected and can only be called by
+classes that extend Node. The parent cannot
+be null; this function will throw an Exception
+if the parent node is empty.
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [parent=null]
+ NodeContainer
+ optional
+
+
+
+
+
+
The parent container node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
writeOpen
+
+
+
+
(
+
+
+
+ [selfClose=true]
+
+
+
+ )
+
+
+
+
+
+ String
+
+
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Start the writing the tag
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ [selfClose=true]
+ Boolean
+ optional
+
+
+
+
+
+
If the tag is a self closing tag (e.g., br, img, hr)
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
String :
+
+
The buffer of HTML
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Properties
+
+
+
+
_attributes
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of Attributes objects
+
+
+
+
+
+
+
+
+
+
+
+
+
_parent
+
NodeContainer
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The parent node, if any
+
+
+
+
+
+
+
+
+
+
+
+
+
_tag
+
String
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The string name of the tag
+
+
+
+
+
+
+
+
+
+
+
+
+
_validAttrs
+
Array
+
+
+
+
+
protected
+
+
+
+
+
+
+
+
+
+
The collection of valid attributes names for given tag
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/classes/html.html b/docs/classes/html.html
new file mode 100644
index 0000000..be6797d
--- /dev/null
+++ b/docs/classes/html.html
@@ -0,0 +1,339 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : html
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
html Class
+
+
+
+
+
+
This is the global function is the main entry for interacting with the HTML5 for PHP library.
+using html()
global function you can create HTML5 quickly and easily. For more
+examples and instruction on how to use this library, please refer to the the
+GitHub project .
+To install the library simply include html.php
, this takes care of any autoloading that's needed
+for the rest of the library.
+
echo html('img src=home.jpg');
+echo html('img', 'src=home.jpg');
+echo html('a', array('href'=>'about.html'));
+
+
+
+
+
+
Constructor
+
+
html
+
+
+
+
(
+
+
+
+ tag
+
+
+
+
+
+ [childrenOrAttributes=null]
+
+
+
+
+
+ [attributes=null]
+
+
+
+ )
+
+
+
+
+
+ Node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+ tag
+ String
+
+
+
+
+
+
The name of the tag as a string for example 'tr', 'table', can be followed
+ by CSS selector, e.g. 'a#backButton' or 'a.button'
+
+
+
+
+
+
+
+
+ [childrenOrAttributes=null]
+ Dictionary | Node | String | Array
+ optional
+
+
+
+
+
+
If the tag is a NodeContainer, this can be an array
+ of attributes, another html node or some text. If the tag is a single node, this can
+ be an array or chain of attributes
+
+
+
+
+
+
+
+
+ [attributes=null]
+ Dictionary | String
+ optional
+
+
+
+
+
+
The attributes list for container tags (e.g., 'class:selected')
+
+
+
+
+
+
+
+
+
+
+
+
+
Returns:
+
+
+
+
+
Node :
+
+
Return the html node
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Item Index
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/data.json b/docs/data.json
new file mode 100644
index 0000000..e71df62
--- /dev/null
+++ b/docs/data.json
@@ -0,0 +1,1531 @@
+{
+ "project": {
+ "name": "Canteen HTML5 API",
+ "description": "Create dynamic, valid HTML5 markup with a simple an intuitive PHP API",
+ "version": "${version}",
+ "logo": ""
+ },
+ "files": {
+ "src/Canteen/HTML5/Attribute.php": {
+ "name": "src/Canteen/HTML5/Attribute.php",
+ "modules": {
+ "Canteen\\HTML5": 1
+ },
+ "classes": {
+ "Attribute": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/Comment.php": {
+ "name": "src/Canteen/HTML5/Comment.php",
+ "modules": {},
+ "classes": {
+ "Comment": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/Document.php": {
+ "name": "src/Canteen/HTML5/Document.php",
+ "modules": {},
+ "classes": {
+ "Document": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/HTML5Error.php": {
+ "name": "src/Canteen/HTML5/HTML5Error.php",
+ "modules": {},
+ "classes": {
+ "HTML5Error": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/Node.php": {
+ "name": "src/Canteen/HTML5/Node.php",
+ "modules": {},
+ "classes": {
+ "Node": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/NodeContainer.php": {
+ "name": "src/Canteen/HTML5/NodeContainer.php",
+ "modules": {},
+ "classes": {
+ "NodeContainer": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/SimpleList.php": {
+ "name": "src/Canteen/HTML5/SimpleList.php",
+ "modules": {},
+ "classes": {
+ "SimpleList": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/Table.php": {
+ "name": "src/Canteen/HTML5/Table.php",
+ "modules": {},
+ "classes": {
+ "Table": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/Text.php": {
+ "name": "src/Canteen/HTML5/Text.php",
+ "modules": {},
+ "classes": {
+ "Text": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ },
+ "src/Canteen/HTML5/html.php": {
+ "name": "src/Canteen/HTML5/html.php",
+ "modules": {
+ "global": 1
+ },
+ "classes": {
+ "html": 1
+ },
+ "fors": {},
+ "namespaces": {}
+ }
+ },
+ "modules": {
+ "Canteen\\HTML5": {
+ "name": "Canteen\\HTML5",
+ "submodules": {},
+ "classes": {
+ "Attribute": 1,
+ "Comment": 1,
+ "Document": 1,
+ "HTML5Error": 1,
+ "Node": 1,
+ "NodeContainer": 1,
+ "SimpleList": 1,
+ "Table": 1,
+ "Text": 1
+ },
+ "fors": {},
+ "namespaces": {},
+ "tag": "module",
+ "file": "src/Canteen/HTML5/Text.php",
+ "line": 8
+ },
+ "global": {
+ "name": "global",
+ "submodules": {},
+ "classes": {
+ "html": 1
+ },
+ "fors": {},
+ "namespaces": {},
+ "tag": "module",
+ "file": "src/Canteen/HTML5/html.php",
+ "line": 32
+ }
+ },
+ "classes": {
+ "Attribute": {
+ "name": "Attribute",
+ "shortname": "Attribute",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 8,
+ "description": "An HTML attribute used on the Node, this is used internally.\nDo not initiate this class directly, use the `html()` function\nto create attributes on elements.\n\n\techo html('a', 'Link', 'class=button href=\"about.html\"');\n\t\n\techo html('a', 'Link')\n\t\t->setAttribute('class', 'button')\n\t\t->setAttribute('href', 'about.html');",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "value",
+ "description": "The value of the attribute",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ]
+ },
+ "Comment": {
+ "name": "Comment",
+ "shortname": "Comment",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Comment.php",
+ "line": 8,
+ "description": "Special node type representing an HTML5 inline comment.\nDo not initiate this class directly, use the `html('comment')` function:\n\n\techo html('comment', 'Hidden HTML comment here');",
+ "extends": "NodeContainer",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "text",
+ "description": "the plain text string",
+ "type": "String"
+ }
+ ]
+ },
+ "Document": {
+ "name": "Document",
+ "shortname": "Document",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 8,
+ "description": "Create an HTML document. Basic barebones structure. \nLocated in the namespace __Canteen\\HTML5__.\n\n\t$doc = new HTML5\\Document('Untitled');\n\t$doc->head->addChild(html('script src=main.js'));\n\t$doc->body->addChild(html('div#frame'));\n\techo $doc;",
+ "extends": "NodeContainer",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "title",
+ "description": "The title of the document",
+ "type": "String",
+ "optional": true,
+ "optdefault": "''"
+ },
+ {
+ "name": "charset",
+ "description": "The character encoding set of this HTML document",
+ "type": "String",
+ "optional": true,
+ "optdefault": "'utf-8'"
+ },
+ {
+ "name": "beautify",
+ "description": "If we should add whitespace to the output to make it look nice markup.",
+ "type": "Boolean",
+ "optional": true,
+ "optdefault": "false"
+ }
+ ]
+ },
+ "HTML5Error": {
+ "name": "HTML5Error",
+ "shortname": "HTML5Error",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 8,
+ "description": "Exceptions with using the HTML5 API.\n\n\ttry\n\t{\n\t\thtml('invalid', 'something');\n\t}\n\tcatch(Canteen\\HTML5\\HTML5Error $e)\n\t{\n\t\t$e->getMessage();\n\t}",
+ "extends": "Exception",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "code",
+ "description": "The code of the error",
+ "type": "Int"
+ },
+ {
+ "name": "data",
+ "description": "Additional data to associate with this error",
+ "type": "String",
+ "optional": true,
+ "optdefault": "''"
+ }
+ ]
+ },
+ "Node": {
+ "name": "Node",
+ "shortname": "Node",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 8,
+ "description": "A generic html tag with any children or closing tag. (e.g., img, br, hr).\nDo not initiate this class directly, use the `html()` function:\n\n\techo html('br');",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "tag",
+ "description": "The name of the tag",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "attributes",
+ "description": "The collection of tag attributes",
+ "type": "Array|String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "validAttrs",
+ "description": "The list of non-global valid attributes for the tag, comma separated",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ]
+ },
+ "NodeContainer": {
+ "name": "NodeContainer",
+ "shortname": "NodeContainer",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 8,
+ "description": "Represents an HTML that that can contain other tags (e.g., br, p, div).\nDo not initiate this class directly, use the `html()` function:\n\n\t$div = html('div');",
+ "extends": "Node",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "tag",
+ "description": "The name of the tag element",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "children",
+ "description": "The collection of children or single child",
+ "type": "Node|Array",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "attributes",
+ "description": "The tag attributes",
+ "type": "String|Dictionary",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "validAttrs",
+ "description": "Valid attributes specific to the HTML5 element, comma separated",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ]
+ },
+ "SimpleList": {
+ "name": "SimpleList",
+ "shortname": "SimpleList",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/SimpleList.php",
+ "line": 8,
+ "description": "Convenience class for creating an ordered or un-ordered list.\n\n\t$list = new Canteen\\HTML5\\SimpleList(\n\t\tarray(\n\t\t\thtml('b', 'first'),\n\t\t\t'second', \n\t\t\t'third',\n\t\t\tarray(\n\t\t\t\t'sub-third',\n\t\t\t\t'sub-forth'\n\t\t\t)\n\t\t)\n\t);",
+ "extends": "NodeContainer",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "elements",
+ "description": "The array of child Nodes, Strings, etc.",
+ "type": "Array",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "attributes",
+ "description": "The optional attributes",
+ "type": "String|Dictionary",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "type",
+ "description": "The type of list, either ul or ol",
+ "type": "String",
+ "optional": true,
+ "optdefault": "'ul'"
+ }
+ ]
+ },
+ "Table": {
+ "name": "Table",
+ "shortname": "Table",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Table.php",
+ "line": 8,
+ "description": "Convenience class for building a Table. Useful for display\nrows of data from a database or another collection\nof associative arrays.\n\t\n\t$table = new Canteen\\HTML5\\Table(\n\t\tarray(\n\t\t\tarray('id'=>1, 'first'=>'James', 'last'=>'Smith'),\n\t\t\tarray('id'=>2, 'first'=>'Mary', 'last'=>'Denver'),\n\t\t\tarray('id'=>3, 'first'=>'Charlie', 'last'=>'Rose')\n\t\t),\n\t\tarray('ID', 'First Name', 'Last Name')\n\t);",
+ "extends": "NodeContainer",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "data",
+ "description": "The collection of Dictionary objects",
+ "type": "Array"
+ },
+ {
+ "name": "headers",
+ "description": "An optional collection of header labels for each value",
+ "type": "Array",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "checkbox",
+ "description": "If we should add a checkbox to each row, this is the name \n of the attribute to use as a value. For instance `array('id'=>2)` is \n ` `",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ]
+ },
+ "Text": {
+ "name": "Text",
+ "shortname": "Text",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "Canteen\\HTML5",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/Text.php",
+ "line": 8,
+ "description": "Special Node representing plain text. Do not initiate this \nclass directly, it is created whenever a text is passed into \na container tag:\n\n\techo html('p', 'Some Text Here');",
+ "extends": "Node",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "text",
+ "description": "the plain text string",
+ "type": "String"
+ }
+ ]
+ },
+ "html": {
+ "name": "html",
+ "shortname": "html",
+ "classitems": [],
+ "plugins": [],
+ "extensions": [],
+ "plugin_for": [],
+ "extension_for": [],
+ "module": "global",
+ "namespace": "",
+ "file": "src/Canteen/HTML5/html.php",
+ "line": 32,
+ "description": "This is the global function is the main entry for interacting with the HTML5 for PHP library. \nusing `html()` global function you can create HTML5 quickly and easily. For more\nexamples and instruction on how to use this library, please refer to the the \nGitHub project . \nTo install the library simply include `html.php`, this takes care of any autoloading that's needed\nfor the rest of the library.\n\n\techo html('img src=home.jpg'); \n\techo html('img', 'src=home.jpg'); \n\techo html('a', array('href'=>'about.html'));",
+ "is_constructor": 1,
+ "params": [
+ {
+ "name": "tag",
+ "description": "The name of the tag as a string for example 'tr', 'table', can be followed \n\t\t by CSS selector, e.g. 'a#backButton' or 'a.button'",
+ "type": "String"
+ },
+ {
+ "name": "childrenOrAttributes",
+ "description": "If the tag is a NodeContainer, this can be an array \n\t\t of attributes, another html node or some text. If the tag is a single node, this can \n be an array or chain of attributes",
+ "type": "Dictionary|Node|String|Array",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "attributes",
+ "description": "The attributes list for container tags (e.g., 'class:selected')",
+ "type": "Dictionary|String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ],
+ "return": {
+ "description": "Return the html node",
+ "type": "Node"
+ }
+ }
+ },
+ "classitems": [
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 26,
+ "description": "The name of the attribute",
+ "itemtype": "property",
+ "name": "_name",
+ "type": "String",
+ "access": "private",
+ "tagname": "",
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 33,
+ "description": "The value of the attribute",
+ "itemtype": "property",
+ "name": "_value",
+ "type": "String",
+ "access": "private",
+ "tagname": "",
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 46,
+ "description": "Convert the attribute to an HTML tag attribute string",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "String representation of attribute",
+ "type": "String"
+ },
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 56,
+ "description": "Get the name of this attribute",
+ "itemtype": "method",
+ "name": "getName",
+ "return": {
+ "description": "The attribute's name",
+ "type": "String"
+ },
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 66,
+ "description": "Set the name of this attribute, cannot be empty",
+ "itemtype": "method",
+ "name": "setName",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ],
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 80,
+ "description": "Get the value of this attribute",
+ "itemtype": "method",
+ "name": "getValue",
+ "access": "protected",
+ "tagname": "",
+ "return": {
+ "description": "The value of attribute",
+ "type": "String"
+ },
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 91,
+ "description": "Set the value of this attribute, this cannot be empty",
+ "itemtype": "method",
+ "name": "setValue",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "value",
+ "description": "The value to set",
+ "type": "String"
+ }
+ ],
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 102,
+ "description": "Convert a string into an associative array",
+ "itemtype": "method",
+ "name": "shorthand",
+ "static": 1,
+ "params": [
+ {
+ "name": "str",
+ "description": "The string, delineated by semicolons, and colons for attributes:values",
+ "type": "String"
+ }
+ ],
+ "return": {
+ "description": "The collection of attributes",
+ "type": "Dictionary"
+ },
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 130,
+ "description": "General purpose getter for getting attribute->name and attribute->value",
+ "access": "public",
+ "tagname": "__get",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the property to get",
+ "type": "String"
+ }
+ ],
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 143,
+ "description": "General purpose setter for setting attribute->name and attribute->value",
+ "access": "public",
+ "tagname": "__set",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute",
+ "type": "String"
+ },
+ {
+ "name": "value",
+ "description": "The value of the attribute",
+ "type": "String"
+ }
+ ],
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Attribute.php",
+ "line": 157,
+ "description": "See if a property exists",
+ "itemtype": "method",
+ "name": "__isset",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the property",
+ "type": "String"
+ }
+ ],
+ "class": "Attribute",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Comment.php",
+ "line": 26,
+ "description": "Write to HTML",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "The string representation of this HTML node",
+ "type": "String"
+ },
+ "class": "Comment",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 26,
+ "description": "The document type",
+ "itemtype": "property",
+ "name": "docType",
+ "type": "NodeContainer",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 32,
+ "description": "The head node",
+ "itemtype": "property",
+ "name": "head",
+ "type": "NodeContainer",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 38,
+ "description": "The body node",
+ "itemtype": "property",
+ "name": "body",
+ "type": "NodeContainer",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 44,
+ "description": "The title node",
+ "itemtype": "property",
+ "name": "title",
+ "type": "NodeContainer",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 50,
+ "description": "Beautify the output",
+ "itemtype": "property",
+ "name": "beautify",
+ "type": "Boolean",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 56,
+ "description": "Constructor for Docs",
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 75,
+ "description": "Write to HTML",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "The string representation of this HTML node",
+ "type": "String"
+ },
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Document.php",
+ "line": 88,
+ "description": "Beautifies an HTML string into a human-readable and indented work of art.",
+ "itemtype": "method",
+ "name": "beautify",
+ "static": 1,
+ "params": [
+ {
+ "name": "html",
+ "description": "The XML-compatible HTML as a string",
+ "type": "String"
+ }
+ ],
+ "return": {
+ "description": "The formatted string",
+ "type": "String"
+ },
+ "class": "Document",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 28,
+ "description": "The database connection failed",
+ "itemtype": "property",
+ "name": "EMPTY_ATTRIBUTE_NAME",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 36,
+ "description": "The alias for a database is invalid",
+ "itemtype": "property",
+ "name": "EMPTY_ATTRIBUTE_VALUE",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 44,
+ "description": "The database name we're trying to switch to is invalid",
+ "itemtype": "property",
+ "name": "INVALID_SETTER",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 52,
+ "description": "The mysql where trying to execute was a problem",
+ "itemtype": "property",
+ "name": "INVALID_GETTER",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 60,
+ "description": "The html tag name is invalid",
+ "itemtype": "property",
+ "name": "INVALID_TAG",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 68,
+ "description": "When trying to create a node, the name is empty",
+ "itemtype": "property",
+ "name": "EMPTY_NODE_TAG",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 76,
+ "description": "The parent cannot be empty",
+ "itemtype": "property",
+ "name": "EMPTY_PARENT",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 84,
+ "description": "THe addChildAt is out of bounds",
+ "itemtype": "property",
+ "name": "OUT_OF_BOUNDS",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 92,
+ "description": "The child node is empty",
+ "itemtype": "property",
+ "name": "EMPTY_CHILD",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 100,
+ "description": "The node is not of instance type Node",
+ "itemtype": "property",
+ "name": "INVALID_NODE",
+ "type": "Int",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 108,
+ "description": "Look-up for error messages",
+ "itemtype": "property",
+ "name": "messages",
+ "type": "Dictionary",
+ "access": "private",
+ "tagname": "",
+ "static": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/HTML5Error.php",
+ "line": 127,
+ "description": "The label for an error that is unknown or unfound in messages",
+ "itemtype": "property",
+ "name": "UNKNOWN",
+ "type": "String",
+ "static": 1,
+ "final": 1,
+ "class": "HTML5Error",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 22,
+ "description": "The string name of the tag",
+ "itemtype": "property",
+ "name": "_tag",
+ "type": "String",
+ "access": "protected",
+ "tagname": "",
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 29,
+ "description": "The collection of Attributes objects",
+ "itemtype": "property",
+ "name": "_attributes",
+ "type": "Array",
+ "access": "protected",
+ "tagname": "",
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 36,
+ "description": "The parent node, if any",
+ "itemtype": "property",
+ "name": "_parent",
+ "type": "NodeContainer",
+ "access": "protected",
+ "tagname": "",
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 43,
+ "description": "The collection of valid attributes names for given tag",
+ "itemtype": "property",
+ "name": "_validAttrs",
+ "type": "Array",
+ "access": "protected",
+ "tagname": "",
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 50,
+ "description": "The default valid attributes",
+ "itemtype": "property",
+ "name": "GLOBAL_ATTRS",
+ "type": "String",
+ "final": 1,
+ "static": 1,
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 90,
+ "description": "Returns the parent node of this node, if\na parent exists. If no parent exists,\nthis function returns null.",
+ "itemtype": "method",
+ "name": "getParent",
+ "access": "private",
+ "tagname": "",
+ "return": {
+ "description": "The parent node object",
+ "type": "NodeContainer"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 103,
+ "description": "Sets the parent of this Node. Note that this\nfunction is protected and can only be called by\nclasses that extend Node. The parent cannot\nbe null; this function will throw an Exception\nif the parent node is empty.",
+ "itemtype": "method",
+ "name": "setParent",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "parent",
+ "description": "The parent container node",
+ "type": "NodeContainer",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 122,
+ "description": "Given a name and value pair, sets an attribute on this Node.\nThe name and value cannot be empty; if so, this function\nwill throw an Exception. Note if the attribute already exists\nand the caller wants to set an attribute of the same name,\nthis function will not create a new Attribute, but rather\nupdate the value of the existing named attribute.",
+ "itemtype": "method",
+ "name": "setAttribute",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute to add",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "value",
+ "description": "The value of the attribute",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ },
+ {
+ "name": "The",
+ "description": "instance of this node",
+ "type": "Node"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 156,
+ "description": "Fetch and attribute by name from this Node. The attribute\nname cannot be null; if so, this function will throw an\nException.",
+ "itemtype": "method",
+ "name": "getAttribute",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute to fetch",
+ "type": "String",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ],
+ "return": {
+ "description": "The attribute's value, if any or null",
+ "type": "String"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 183,
+ "description": "Set the list of all attributes.",
+ "itemtype": "method",
+ "name": "setAttributes",
+ "params": [
+ {
+ "name": "values",
+ "description": "An attributes array(name=>value, name=>value)",
+ "type": "Dictionary"
+ }
+ ],
+ "return": {
+ "description": "The instance of this Node",
+ "type": "Node"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 201,
+ "description": "Set the a data-* HTML5 Attribute",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the data, for instance \"id\" is an attribute \"data-id\"",
+ "type": "String"
+ },
+ {
+ "name": "value",
+ "description": "The value of the attribute",
+ "type": "String"
+ }
+ ],
+ "return": {
+ "description": "The instance of this Node",
+ "type": "Node"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 212,
+ "description": "Add this child to a node container at the end",
+ "itemtype": "method",
+ "name": "appendTo",
+ "params": [
+ {
+ "name": "container",
+ "description": "The node container to add to",
+ "type": "NodeContainer"
+ }
+ ],
+ "return": {
+ "description": "The instance of this Node",
+ "type": "Node"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 224,
+ "description": "Add this child to the beginning of a node container",
+ "itemtype": "method",
+ "name": "prependTo",
+ "params": [
+ {
+ "name": "container",
+ "description": "The node container to prepend to to",
+ "type": "NodeContainer"
+ }
+ ],
+ "return": {
+ "description": "The instance of this Node",
+ "type": "Node"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 236,
+ "description": "Get the data-* HTML5 attribute value, if set",
+ "itemtype": "method",
+ "name": "getData",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the data attribute",
+ "type": "String"
+ }
+ ],
+ "return": {
+ "description": "The value of the data",
+ "type": "String"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 247,
+ "description": "Write to HTML",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "The string representation of this HTML node",
+ "type": "String"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 257,
+ "description": "Start the writing the tag",
+ "itemtype": "method",
+ "name": "writeOpen",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "selfClose",
+ "description": "If the tag is a self closing tag (e.g., br, img, hr)",
+ "type": "Boolean",
+ "optional": true,
+ "optdefault": "true"
+ }
+ ],
+ "return": {
+ "description": "The buffer of HTML",
+ "type": "String"
+ },
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 276,
+ "description": "General purpose getter to get attribute values",
+ "itemtype": "method",
+ "name": "__get",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the property to set",
+ "type": "String"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 290,
+ "description": "General purpose setter to set attribute values",
+ "itemtype": "method",
+ "name": "__set",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute",
+ "type": "String"
+ },
+ {
+ "name": "value",
+ "description": "The value of the attribute",
+ "type": "String"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 305,
+ "description": "See if a property exists",
+ "itemtype": "method",
+ "name": "__isset",
+ "params": [
+ {
+ "name": "name",
+ "description": "The name of the attribute",
+ "type": "String"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Node.php",
+ "line": 315,
+ "description": "Checks if a variable is really \"empty\". Code borrowed from PHP.net at\nhttp://us3.php.net/manual/en/function.empty.php#90767 because we were\npreviously using empty() to see if a variable is empty or not. But\nempty() dosen't work for attributes that have a value of \"0\", so we need\nsomething more robust here.\n \nan unset variable -> empty \nnull -> empty \n0 -> NOT empty \n\"0\" -> NOT empty \nfalse -> empty \ntrue -> NOT empty \n'string value' -> NOT empty \n\"\t\"(white space) -> empty \narray()(empty array) -> empty \n ",
+ "itemtype": "method",
+ "name": "isEmpty",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "var",
+ "description": "The variable to check for empty on",
+ "type": "Mixed"
+ }
+ ],
+ "class": "Node",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 24,
+ "description": "The collection of children nodes",
+ "itemtype": "property",
+ "name": "_children",
+ "type": "Array",
+ "access": "private",
+ "tagname": "",
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 57,
+ "description": "Add's a child to this NodeContainer. The child to add cannot be null.",
+ "itemtype": "method",
+ "name": "addChild",
+ "params": [
+ {
+ "name": "childNode",
+ "description": "The child Node to add",
+ "type": "Node|String|Number|Boolean"
+ }
+ ],
+ "return": {
+ "description": "The instance of this container",
+ "type": "NodeContainer"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 69,
+ "description": "Add a child at a specific index",
+ "itemtype": "method",
+ "name": "addChildAt",
+ "params": [
+ {
+ "name": "childNode",
+ "description": "The child Node to add",
+ "type": "Node|String|Number|Boolean"
+ },
+ {
+ "name": "index",
+ "description": "The index to add child at, 0 is top",
+ "type": "Int"
+ }
+ ],
+ "return": {
+ "description": "The instance of this container",
+ "type": "NodeContainer"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 98,
+ "description": "Before adding a child, we should do some checking for basic types\nand convert it into a more useable Node object.",
+ "itemtype": "method",
+ "name": "prepareChild",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "childNode",
+ "description": "The child node to add",
+ "type": "Node|String|Number|Boolean"
+ }
+ ],
+ "return": {
+ "description": "The child node",
+ "type": "Node"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 128,
+ "description": "Removes the first instance of child from this. \nOnce the first instance of the child\nis removed, this function will return. It returns\ntrue if a child was removed and false if no child\nwas removed.",
+ "itemtype": "method",
+ "name": "removeChild",
+ "params": [
+ {
+ "name": "childNode",
+ "description": "The node to remove",
+ "type": "Node",
+ "optional": true,
+ "optdefault": "null"
+ }
+ ],
+ "return": {
+ "description": "If successfully removed",
+ "type": "Boolean"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 157,
+ "description": "Remove a child as a specific index",
+ "itemtype": "method",
+ "name": "removeChildAt",
+ "params": [
+ {
+ "name": "index",
+ "description": "The index to remove child at",
+ "type": "Int"
+ }
+ ],
+ "return": {
+ "description": "The instance of the node container",
+ "type": "NodeContainer"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 173,
+ "description": "Removes all children attached to this Node container",
+ "itemtype": "method",
+ "name": "removeChildren",
+ "return": {
+ "description": "The instance of the node container",
+ "type": "NodeContainer"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 185,
+ "description": "Returns an array of all children attached to this Node container.",
+ "itemtype": "method",
+ "name": "getChildren",
+ "return": {
+ "description": "The collection of Node objects",
+ "type": "Array"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 195,
+ "description": "Gets a child of this Node container at given\nindex. If no index is passed in, getChild()\nwill return the child at index zero (0).",
+ "itemtype": "method",
+ "name": "getChildAt",
+ "params": [
+ {
+ "name": "index",
+ "description": "The index to fetch child Node at",
+ "type": "Int",
+ "optional": true,
+ "optdefault": "0"
+ }
+ ],
+ "return": {
+ "description": "The child Node",
+ "type": "Node"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 208,
+ "description": "Close the writing of this container as HTML",
+ "itemtype": "method",
+ "name": "writeClose",
+ "access": "protected",
+ "tagname": "",
+ "return": {
+ "description": "The closing HTML tag element",
+ "type": "String"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/NodeContainer.php",
+ "line": 219,
+ "description": "Write to HTML",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "The string representation of this HTML node",
+ "type": "String"
+ },
+ "class": "NodeContainer",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/SimpleList.php",
+ "line": 48,
+ "description": "Override for the prepareChild method on NodeContainer which \nwraps each elements in a list item",
+ "itemtype": "method",
+ "name": "prepareChild",
+ "access": "protected",
+ "tagname": "",
+ "params": [
+ {
+ "name": "childNode",
+ "description": "The child node to add, an array will get converted into another list elements.",
+ "type": "Node|String|Number|Boolean|Array"
+ }
+ ],
+ "return": {
+ "description": "The child node",
+ "type": "Node"
+ },
+ "class": "SimpleList",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/Text.php",
+ "line": 27,
+ "description": "Write to HTML",
+ "itemtype": "method",
+ "name": "__toString",
+ "return": {
+ "description": "The string representation of this HTML node",
+ "type": "String"
+ },
+ "class": "Text",
+ "module": "Canteen\\HTML5"
+ },
+ {
+ "file": "src/Canteen/HTML5/html.php",
+ "line": 7,
+ "description": "Auto load the assets in this library",
+ "class": "html",
+ "module": "global"
+ }
+ ],
+ "warnings": [
+ {
+ "message": "Missing item type\nGeneral purpose getter for getting attribute->name and attribute->value",
+ "line": " src/Canteen/HTML5/Attribute.php:130"
+ },
+ {
+ "message": "Missing item type\nGeneral purpose setter for setting attribute->name and attribute->value",
+ "line": " src/Canteen/HTML5/Attribute.php:143"
+ },
+ {
+ "message": "Missing item type\nConstructor for Docs",
+ "line": " src/Canteen/HTML5/Document.php:56"
+ },
+ {
+ "message": "Missing item type\nSet the a data-* HTML5 Attribute",
+ "line": " src/Canteen/HTML5/Node.php:201"
+ },
+ {
+ "message": "Missing item type\nAuto load the assets in this library",
+ "line": " src/Canteen/HTML5/html.php:7"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000..66d1115
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation :
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
+
+
+
+
Keyboard Shortcuts
+
+
+ Press s to focus the API search box.
+
+ Use Up and Down to select classes, modules, and search results.
+
+ With the API search box or sidebar focused, use ⌘ -Left or ⌘ -Right to switch sidebar tabs.
+
+ With the API search box or sidebar focused, use Ctrl+Left and Ctrl+Right to switch sidebar tabs.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/modules/Canteen_HTML5.html b/docs/modules/Canteen_HTML5.html
new file mode 100644
index 0000000..4a2352c
--- /dev/null
+++ b/docs/modules/Canteen_HTML5.html
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : Canteen_HTML5
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
Canteen_HTML5 Namespace
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This namespace provides the following classes:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/modules/global.html b/docs/modules/global.html
new file mode 100644
index 0000000..38186d6
--- /dev/null
+++ b/docs/modules/global.html
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+ Canteen HTML5 API v${version} API Documentation : global
+
+
+
+
+
+
+
+
+
+
+
+
+ Show:
+
+
+ Inherited
+
+
+
+
+ Protected
+
+
+
+
+ Private
+
+
+
+ Deprecated
+
+
+
+
+
+
+
global Namespace
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This namespace provides the following classes:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/document.php b/examples/document.php
new file mode 100644
index 0000000..2a6f229
--- /dev/null
+++ b/examples/document.php
@@ -0,0 +1,52 @@
+beautify = true;
+
+ // Add a link to the page
+ $link = html('a#google.external rel=external', 'Link', 'class="test something" target=blank rel=test');
+ $link->href = 'http://google.com';
+ $link->appendTo($doc->body);
+
+ // Create an unordered list for an array of items
+ // the array can be other html elements or text
+ $list = new SimpleList(
+ array(
+ html('b', 'first'),
+ 'second',
+ 'third',
+ array(
+ 'sub-third',
+ 'sub-forth'
+ )
+ )
+ );
+ $list->appendTo($doc->body);
+
+ // Create a sample table with some rows of dummy data
+ $table = new Table(
+ array(
+ array('id'=>1, 'first'=>'James', 'last'=>'Smith'),
+ array('id'=>2, 'first'=>'Mary', 'last'=>'Denver'),
+ array('id'=>3, 'first'=>'Charlie', 'last'=>'Rose')
+ ),
+ array('ID', 'First Name', 'Last Name')
+ );
+
+ // We'll set some of the table properties
+ $table->style = 'border:1px solid black';
+ $table->border = 0;
+ $table->id = 'people';
+ $table->appendTo($doc->body);
+
+ // Output the result formatted nice with indents
+ echo $doc;
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Attribute.php b/src/Canteen/HTML5/Attribute.php
new file mode 100644
index 0000000..b25c29f
--- /dev/null
+++ b/src/Canteen/HTML5/Attribute.php
@@ -0,0 +1,170 @@
+setAttribute('class', 'button')
+ * ->setAttribute('href', 'about.html');
+ *
+ * @class Attribute
+ * @constructor
+ * @param {String} [name=null] The name of the attribute
+ * @param {String} [value=null] The value of the attribute
+ */
+ class Attribute
+ {
+ /**
+ * The name of the attribute
+ * @property {String} _name
+ * @private
+ */
+ private $_name;
+
+ /**
+ * The value of the attribute
+ * @property {String} _value
+ * @private
+ */
+ private $_value;
+
+ public function __construct($name = null, $value = null)
+ {
+ $this->name = $name;
+ $this->value = $value;
+ }
+
+ /**
+ * Convert the attribute to an HTML tag attribute string
+ * @method __toString
+ * @return {String} String representation of attribute
+ */
+ public function __toString()
+ {
+ return " " . $this->_name . "=\"" . $this->_value . "\"";
+ }
+
+ /**
+ * Get the name of this attribute
+ * @method getName
+ * @return {String} The attribute's name
+ */
+ public function getName()
+ {
+ return $this->_name;
+ }
+
+ /**
+ * Set the name of this attribute, cannot be empty
+ * @method setName
+ * @param {String} [name=null] The name of the attribute
+ */
+ public function setName($name = null)
+ {
+ if (is_null($name) || empty($name))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_ATTRIBUTE_NAME);
+ }
+ $this->_name = $name;
+ }
+
+ /**
+ * Get the value of this attribute
+ * @method getValue
+ * @protected
+ * @return {String} The value of attribute
+ */
+ protected function getValue()
+ {
+ return $this->_value;
+ }
+
+ /**
+ * Set the value of this attribute, this cannot be empty
+ * @method setValue
+ * @protected
+ * @param {String} value The value to set
+ */
+ protected function setValue($value)
+ {
+ $this->_value = $value;
+ }
+
+ /**
+ * Convert a string into an associative array
+ * @method shorthand
+ * @static
+ * @param {String} str The string, delineated by semicolons, and colons for attributes:values
+ * @return {Dictionary} The collection of attributes
+ */
+ static public function shorthand($str)
+ {
+ $res = array();
+
+ // Match the name=value in the attributes string
+ preg_match_all('/([a-z]+[a-z\-]*)\=("[^\"]*"|\'[^\']*\'|[^\s\"\']*)/',$str, $arr);
+
+ foreach($arr[1] as $i=>$name)
+ {
+ $value = $arr[2][$i];
+
+ // Remove containing quotes if present
+ if (preg_match('/^[\'\"][^\n]*[\'\"]$/', $value))
+ {
+ $value = substr($value, 1, -1);
+ }
+ $res[$name] = $value;
+ }
+ return $res;
+ }
+
+ /**
+ * General purpose getter for getting attribute->name and attribute->value
+ * @public __get
+ * @param {String} name The name of the property to get
+ */
+ public function __get($name)
+ {
+ if (method_exists($this , $method =('get' . ucfirst($name))))
+ return $this->$method();
+ else
+ throw new HTML5Error(HTML5Error::INVALID_GETTER, $name);
+ }
+
+ /**
+ * General purpose setter for setting attribute->name and attribute->value
+ * @public __set
+ * @param {String} name The name of the attribute
+ * @param {String} value The value of the attribute
+ */
+ public function __set($name, $value)
+ {
+ if (method_exists($this , $method =('set' . ucfirst($name))))
+ return $this->$method($value);
+ else
+ throw new HTML5Error(HTML5Error::INVALID_SETTER, $name);
+ }
+
+ /**
+ * See if a property exists
+ * @method __isset
+ * @param {String} name The name of the property
+ */
+ public function __isset($name)
+ {
+ return method_exists($this , 'get' . ucfirst($name))
+ || method_exists($this , 'set' . ucfirst($name));
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Comment.php b/src/Canteen/HTML5/Comment.php
new file mode 100644
index 0000000..44ffe22
--- /dev/null
+++ b/src/Canteen/HTML5/Comment.php
@@ -0,0 +1,38 @@
+_tag.' -->';
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Document.php b/src/Canteen/HTML5/Document.php
new file mode 100644
index 0000000..3a7dd1e
--- /dev/null
+++ b/src/Canteen/HTML5/Document.php
@@ -0,0 +1,112 @@
+head->addChild(html('script src=main.js'));
+ * $doc->body->addChild(html('div#frame'));
+ * echo $doc;
+ *
+ * @class Document
+ * @extends NodeContainer
+ * @constructor
+ * @param {String} [title=''] The title of the document
+ * @param {String} [charset='utf-8'] The character encoding set of this HTML document
+ * @param {Boolean} [beautify=false] If we should add whitespace to the output to make it look nice markup.
+ */
+ class Document extends NodeContainer
+ {
+ /**
+ * The document type
+ * @property {NodeContainer} docType
+ */
+ private $docType;
+
+ /**
+ * The head node
+ * @property {NodeContainer} head
+ */
+ public $head;
+
+ /**
+ * The body node
+ * @property {NodeContainer} body
+ */
+ public $body;
+
+ /**
+ * The title node
+ * @property {NodeContainer} title
+ */
+ public $title;
+
+ /**
+ * Beautify the output
+ * @property {Boolean} beautify
+ */
+ public $beautify = false;
+
+ /**
+ * Constructor for Docs
+ */
+ public function __construct($title='', $charset='utf-8', $beautify=false)
+ {
+ parent::__construct('html', null, null, 'manifest');
+
+ $this->docType = html('doctype');
+ $this->head = html('head');
+ $this->body = html('body');
+ $this->title = html('title', $title);
+
+ $this->head->addChild(html('meta', 'charset='.$charset));
+ $this->head->addChild($this->title);
+
+ $this->addChild($this->head);
+ $this->addChild($this->body);
+ }
+
+ /**
+ * Write to HTML
+ * @method __toString
+ * @return {String} The string representation of this HTML node
+ */
+ public function __toString()
+ {
+ $result = $this->docType . parent::__toString();
+ if ($this->beautify)
+ $result = self::beautify($result);
+ return $result;
+ }
+
+ /**
+ * Beautifies an HTML string into a human-readable and indented work of art.
+ * @method beautify
+ * @static
+ * @param {String} html The XML-compatible HTML as a string
+ * @return {String} The formatted string
+ */
+ public static function beautify($html)
+ {
+ // Conver the HTML -> SimpleXML -> DOMDocument
+ $dom = dom_import_simplexml(new \SimpleXMLElement($html))->ownerDocument;
+
+ // Format the DOMDocument
+ $dom->formatOutput = true;
+
+ // Save the output as XML
+ $buffer = $dom->saveXML();
+
+ // Remove the first line which has the XML declaration
+ return substr($buffer, strpos($buffer, "\n")+1);
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/HTML5Error.php b/src/Canteen/HTML5/HTML5Error.php
new file mode 100644
index 0000000..a9a9cdd
--- /dev/null
+++ b/src/Canteen/HTML5/HTML5Error.php
@@ -0,0 +1,144 @@
+getMessage();
+ * }
+ *
+ * @class HTML5Error
+ * @extends Exception
+ * @constructor
+ * @param {int} code The code of the error
+ * @param {String} [data=''] Additional data to associate with this error
+ */
+ class HTML5Error extends \Exception
+ {
+ /**
+ * The database connection failed
+ * @property {int} EMPTY_ATTRIBUTE_NAME
+ * @static
+ * @final
+ */
+ const EMPTY_ATTRIBUTE_NAME = 500;
+
+ /**
+ * The alias for a database is invalid
+ * @property {int} EMPTY_ATTRIBUTE_VALUE
+ * @static
+ * @final
+ */
+ const EMPTY_ATTRIBUTE_VALUE = 501;
+
+ /**
+ * The database name we're trying to switch to is invalid
+ * @property {int} INVALID_SETTER
+ * @static
+ * @final
+ */
+ const INVALID_SETTER = 502;
+
+ /**
+ * The mysql where trying to execute was a problem
+ * @property {int} INVALID_GETTER
+ * @static
+ * @final
+ */
+ const INVALID_GETTER = 503;
+
+ /**
+ * The html tag name is invalid
+ * @property {int} INVALID_TAG
+ * @static
+ * @final
+ */
+ const INVALID_TAG = 504;
+
+ /**
+ * When trying to create a node, the name is empty
+ * @property {int} EMPTY_NODE_TAG
+ * @static
+ * @final
+ */
+ const EMPTY_NODE_TAG = 505;
+
+ /**
+ * The parent cannot be empty
+ * @property {int} EMPTY_PARENT
+ * @static
+ * @final
+ */
+ const EMPTY_PARENT = 506;
+
+ /**
+ * THe addChildAt is out of bounds
+ * @property {int} OUT_OF_BOUNDS
+ * @static
+ * @final
+ */
+ const OUT_OF_BOUNDS = 507;
+
+ /**
+ * The child node is empty
+ * @property {int} EMPTY_CHILD
+ * @static
+ * @final
+ */
+ const EMPTY_CHILD = 508;
+
+ /**
+ * The node is not of instance type Node
+ * @property {int} INVALID_NODE
+ * @static
+ * @final
+ */
+ const INVALID_NODE = 509;
+
+ /**
+ * Look-up for error messages
+ * @property {Dictionary} messages
+ * @private
+ * @static
+ */
+ private static $messages = array(
+ self::EMPTY_ATTRIBUTE_NAME => 'Attribute names cannot be empty',
+ self::EMPTY_ATTRIBUTE_VALUE => 'Attribute values cannot be empty',
+ self::INVALID_SETTER => 'Cannot set the property because name is invalid',
+ self::INVALID_GETTER => 'Cannot get the property because name is invalid',
+ self::INVALID_TAG => 'Not a valid HTML5 tag name',
+ self::EMPTY_NODE_TAG => 'Node tag is empty',
+ self::EMPTY_PARENT => 'The parent cannot be empty',
+ self::OUT_OF_BOUNDS => 'The index is out of bounds',
+ self::EMPTY_CHILD => 'Cannot addChild an empty child node',
+ self::INVALID_NODE => 'Child node must be a valid tag'
+ );
+
+ /**
+ * The label for an error that is unknown or unfound in messages
+ * @property {String} UNKNOWN
+ * @static
+ * @final
+ */
+ const UNKNOWN = 'Unknown error';
+
+ public function __construct($code, $data='')
+ {
+ $message = (isset(self::$messages[$code]) ? self::$messages[$code]: self::UNKNOWN)
+ . ($data ? ' : ' . $data : $data);
+ parent::__construct($message, $code);
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Node.php b/src/Canteen/HTML5/Node.php
new file mode 100644
index 0000000..3b3a719
--- /dev/null
+++ b/src/Canteen/HTML5/Node.php
@@ -0,0 +1,346 @@
+isEmpty($tag))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_NODE_TAG);
+ }
+ $this->_parent = null;
+ $this->_tag = $tag;
+ $this->_attributes = array();
+
+ $validAttrs = is_string($validAttrs) ? explode(',', $validAttrs) : $validAttrs;
+ $this->_validAttrs = explode(',', self::GLOBAL_ATTRS);
+
+ if ($validAttrs !== null)
+ {
+ $this->_validAttrs = array_merge($this->_validAttrs, $validAttrs);
+ }
+
+ if ($attributes !== null)
+ {
+ if (is_string($attributes))
+ {
+ $attributes = Attribute::shorthand($attributes);
+ }
+
+ if (is_array($attributes))
+ {
+ $this->setAttributes($attributes);
+ }
+ }
+ }
+
+ /**
+ * Returns the parent node of this node, if
+ * a parent exists. If no parent exists,
+ * this function returns null.
+ * @method getParent
+ * @private
+ * @return {NodeContainer} The parent node object
+ */
+ private function getParent()
+ {
+ return $this->_parent;
+ }
+
+ /**
+ * Sets the parent of this Node. Note that this
+ * function is protected and can only be called by
+ * classes that extend Node. The parent cannot
+ * be null; this function will throw an Exception
+ * if the parent node is empty.
+ * @method setParent
+ * @protected
+ * @param {NodeContainer} [parent=null] The parent container node
+ */
+ protected function setParent(NodeContainer $parent = null)
+ {
+ if ($this->isEmpty($parent))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_PARENT);
+ }
+ $this->_parent = $parent;
+ }
+
+ /**
+ * Given a name and value pair, sets an attribute on this Node.
+ * The name and value cannot be empty; if so, this function
+ * will throw an Exception. Note if the attribute already exists
+ * and the caller wants to set an attribute of the same name,
+ * this function will not create a new Attribute, but rather
+ * update the value of the existing named attribute.
+ *
+ * @method setAttribute
+ * @param {String} [name=null] The name of the attribute to add
+ * @param {String} [value=null] The value of the attribute
+ * @param {Node} The instance of this node
+ */
+ public function setAttribute($name = null, $value = null)
+ {
+ if ($this->isEmpty($name))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_ATTRIBUTE_NAME);
+ }
+ foreach($this->_attributes as $i=>$attribute)
+ {
+ if ($attribute->name === $name)
+ {
+ if (!$this->isEmpty($value))
+ $attribute->value = $value;
+ else
+ unset($this->_attributes[$i]);
+ return $this;
+ }
+ }
+ $this->_attributes[] = new Attribute($name, $value);
+ return $this;
+ }
+
+ /**
+ * Fetch and attribute by name from this Node. The attribute
+ * name cannot be null; if so, this function will throw an
+ * Exception.
+ * @method getAttribute
+ * @param {String} [name=null] The name of the attribute to fetch
+ * @return {String} The attribute's value, if any or null
+ */
+ protected function getAttribute($name = null)
+ {
+ $returnAttr = null;
+
+ if ($this->isEmpty($name))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_ATTRIBUTE_NAME);
+ }
+ foreach($this->_attributes as $attribute)
+ {
+ if ($attribute->name === $name)
+ {
+ $returnAttr = $attribute->value;
+ break;
+ }
+ }
+ return $returnAttr;
+ }
+
+ /**
+ * Set the list of all attributes.
+ * @method setAttributes
+ * @param {Dictionary} values An attributes array(name=>value, name=>value)
+ * @return {Node} The instance of this Node
+ */
+ public function setAttributes($values)
+ {
+ if (is_array($values))
+ {
+ foreach($values as $name=>$value)
+ {
+ $this->setAttribute($name, $value);
+ }
+ return $this;
+ }
+ }
+
+ /**
+ * Set the a data-* HTML5 Attribute
+ * @param {String} name The name of the data, for instance "id" is an attribute "data-id"
+ * @param {String} value The value of the attribute
+ * @return {Node} The instance of this Node
+ */
+ public function setData($name, $value)
+ {
+ return $this->setAttribute('data-'.$name, $value);
+ }
+
+ /**
+ * Add this child to a node container at the end
+ * @method appendTo
+ * @param {NodeContainer} container The node container to add to
+ * @return {Node} The instance of this Node
+ */
+ public function appendTo(NodeContainer $container)
+ {
+ $container->addChild($this);
+ return $this;
+ }
+
+ /**
+ * Add this child to the beginning of a node container
+ * @method prependTo
+ * @param {NodeContainer} container The node container to prepend to to
+ * @return {Node} The instance of this Node
+ */
+ public function prependTo(NodeContainer $container)
+ {
+ $container->addChildAt($this, 0);
+ return $this;
+ }
+
+ /**
+ * Get the data-* HTML5 attribute value, if set
+ * @method getData
+ * @param {String} name The name of the data attribute
+ * @return {String} The value of the data
+ */
+ public function getData($name)
+ {
+ return $this->getAttribute('data-'.$name);
+ }
+
+ /**
+ * Write to HTML
+ * @method __toString
+ * @return {String} The string representation of this HTML node
+ */
+ public function __toString()
+ {
+ return $this->writeOpen();
+ }
+
+ /**
+ * Start the writing the tag
+ * @method writeOpen
+ * @protected
+ * @param {Boolean} [selfClose=true] If the tag is a self closing tag (e.g., br, img, hr)
+ * @return {String} The buffer of HTML
+ */
+ protected function writeOpen($selfClose=true)
+ {
+ $buffer = '<';
+ $buffer .= $this->_tag;
+ foreach($this->_attributes as $attribute)
+ {
+ $buffer .= (string)$attribute;
+ }
+ $buffer .= ($selfClose ? ' />' : '>');
+ return $buffer;
+ }
+
+ /**
+ * General purpose getter to get attribute values
+ * @method __get
+ * @param {String} name The name of the property to set
+ */
+ public function __get($name)
+ {
+ if (in_array($name, $this->_validAttrs) || strpos($name, 'data-') === 0)
+ {
+ return $this->getAttribute($name);
+ }
+ return parent::__get($name);
+ }
+
+ /**
+ * General purpose setter to set attribute values
+ * @method __set
+ * @param {String} name The name of the attribute
+ * @param {String} value The value of the attribute
+ */
+ public function __set($name, $value)
+ {
+ if (in_array($name, $this->_validAttrs) || strpos($name, 'data-') === 0)
+ {
+ return $this->setAttribute($name, $value);
+ }
+ return parent::__set($name);
+ }
+
+ /**
+ * See if a property exists
+ * @method __isset
+ * @param {String} name The name of the attribute
+ */
+ public function __isset($name)
+ {
+ return in_array($name, $this->_validAttrs) || parent::__isset($name);
+ }
+
+ /**
+ * Checks if a variable is really "empty". Code borrowed from PHP.net at
+ * http://us3.php.net/manual/en/function.empty.php#90767 because we were
+ * previously using empty() to see if a variable is empty or not. But
+ * empty() dosen't work for attributes that have a value of "0", so we need
+ * something more robust here.
+ *
+ * an unset variable -> empty
+ * null -> empty
+ * 0 -> NOT empty
+ * "0" -> NOT empty
+ * false -> empty
+ * true -> NOT empty
+ * 'string value' -> NOT empty
+ * " "(white space) -> empty
+ * array()(empty array) -> empty
+ *
+ * @method isEmpty
+ * @protected
+ * @param {mixed} var The variable to check for empty on
+ */
+ protected function isEmpty($var)
+ {
+ return (!isset($var) || is_null($var) ||
+ (!is_object($var) && is_string($var) && trim($var) == '' && !is_bool($var)) ||
+ (is_bool($var) && $var === false) ||
+ (is_array($var) && empty($var)));
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/NodeContainer.php b/src/Canteen/HTML5/NodeContainer.php
new file mode 100644
index 0000000..f56c08e
--- /dev/null
+++ b/src/Canteen/HTML5/NodeContainer.php
@@ -0,0 +1,238 @@
+isEmpty($tag))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_NODE_TAG);
+ }
+ parent::__construct($tag, $attributes, $validAttrs);
+
+ $this->_children = array();
+
+ if (!$this->isEmpty($children))
+ {
+ if (!is_array($children))
+ {
+ $children = array($children);
+ }
+ if (is_array($children))
+ {
+ foreach($children as $child)
+ {
+ $this->addChild($child);
+ }
+ }
+ }
+ }
+
+ /**
+ * Add's a child to this NodeContainer. The child to add cannot be null.
+ * @method addChild
+ * @param {Node|String|Number|Boolean} childNode The child Node to add
+ * @return {NodeContainer} The instance of this container
+ */
+ public function addChild($childNode)
+ {
+ array_push($this->_children, $this->prepareChild($childNode));
+ return $this;
+ }
+
+ /**
+ * Add a child at a specific index
+ * @method addChildAt
+ * @param {Node|String|Number|Boolean} childNode The child Node to add
+ * @param {int} index The index to add child at, 0 is top
+ * @return {NodeContainer} The instance of this container
+ */
+ public function addChildAt($childNode, $index)
+ {
+ if ($index < 0)
+ {
+ throw new HTML5Error(HTML5Error::OUT_OF_BOUNDS, $index);
+ }
+ $childNode = $this->prepareChild($childNode);
+ if ($index == 0)
+ {
+ array_unshift($this->_children, $childNode);
+ }
+ else if ($index > $len)
+ {
+ $this->addChild($childNode);
+ }
+ else
+ {
+ array_splice($this->_children, $index , 0, array($childNode));
+ }
+ return $this;
+ }
+
+ /**
+ * Before adding a child, we should do some checking for basic types
+ * and convert it into a more useable Node object.
+ * @method prepareChild
+ * @protected
+ * @param {Node|String|Number|Boolean} childNode The child node to add
+ * @return {Node} The child node
+ */
+ protected function prepareChild($childNode)
+ {
+ if ($this->isEmpty($childNode))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_CHILD);
+ }
+ if (is_bool($childNode))
+ {
+ $childNode = new Text($childNode ? 'true' : 'false');
+ }
+ else if (is_string($childNode) || is_numeric($childNode))
+ {
+ $childNode = new Text($childNode);
+ }
+ if (!($childNode instanceof Node))
+ {
+ throw new HTML5Error(HTML5Error::INVALID_NODE);
+ }
+ $childNode->setParent($this);
+ return $childNode;
+ }
+
+ /**
+ * Removes the first instance of child from this.
+ * Once the first instance of the child
+ * is removed, this function will return. It returns
+ * true if a child was removed and false if no child
+ * was removed.
+ * @method removeChild
+ * @param {Node} [childNode=null] The node to remove
+ * @return {Boolean} If successfully removed
+ */
+ public function removeChild(Node $childNode = null)
+ {
+ if ($this->isEmpty($childNode))
+ {
+ throw new HTML5Error(HTML5Error::EMPTY_CHILD);
+ }
+
+ for($i = 0; $i < count($this->_children); $i++)
+ {
+ $child = $this->_children[$i];
+ if ($child === $childNode)
+ {
+ unset($this->_children[$i]);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove a child as a specific index
+ * @method removeChildAt
+ * @param {int} index The index to remove child at
+ * @return {NodeContainer} The instance of the node container
+ */
+ public function removeChildAt($index)
+ {
+ if ($index >= $this->_children || $index < 0)
+ {
+ throw new HTML5Error(HTML5Error::OUT_OF_BOUNDS, $index);
+ }
+ array_splice($this->_children, $index, 1);
+ return $this;
+ }
+
+ /**
+ * Removes all children attached to this Node container
+ * @method removeChildren
+ * @return {NodeContainer} The instance of the node container
+ */
+ public function removeChildren()
+ {
+ unset($this->_children);
+ $this->_children = array();
+ return $this;
+ }
+
+ /**
+ * Returns an array of all children attached to this Node container.
+ * @method getChildren
+ * @return {Array} The collection of Node objects
+ */
+ public function getChildren()
+ {
+ return $this->_children;
+ }
+
+ /**
+ * Gets a child of this Node container at given
+ * index. If no index is passed in, getChild()
+ * will return the child at index zero (0).
+ * @method getChildAt
+ * @param {int} [index=0] The index to fetch child Node at
+ * @return {Node} The child Node
+ */
+ public function getChildAt($index = 0)
+ {
+ return $this->_children[$index];
+ }
+
+ /**
+ * Close the writing of this container as HTML
+ * @method writeClose
+ * @protected
+ * @return {String} The closing HTML tag element
+ */
+ protected function writeClose()
+ {
+ return "" . $this->_tag . ">";
+ }
+
+ /**
+ * Write to HTML
+ * @method __toString
+ * @return {String} The string representation of this HTML node
+ */
+ public function __toString()
+ {
+ $buffer = $this->writeOpen(false);
+ foreach($this->_children as $child)
+ {
+ $buffer .= $child->__toString();
+ }
+ $buffer .= $this->writeClose();
+
+ return $buffer;
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/SimpleList.php b/src/Canteen/HTML5/SimpleList.php
new file mode 100644
index 0000000..49d491b
--- /dev/null
+++ b/src/Canteen/HTML5/SimpleList.php
@@ -0,0 +1,73 @@
+addChild($child);
+ }
+ }
+ }
+
+ /**
+ * Override for the prepareChild method on NodeContainer which
+ * wraps each elements in a list item
+ * @method prepareChild
+ * @protected
+ * @param {Node|String|Number|Boolean|Array} childNode The child node to add, an array will get converted into another list elements.
+ * @return {Node} The child node
+ */
+ protected function prepareChild($childNode)
+ {
+ // Recursively create new lists for each array
+ if (is_array($childNode))
+ {
+ $list = new SimpleList($childNode, null, $this->_tag);
+ return $this->prepareChild($list);
+ }
+ else
+ {
+ $childNode = parent::prepareChild($childNode);
+ return html('li', $childNode);
+ }
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Table.php b/src/Canteen/HTML5/Table.php
new file mode 100644
index 0000000..5166d42
--- /dev/null
+++ b/src/Canteen/HTML5/Table.php
@@ -0,0 +1,86 @@
+1, 'first'=>'James', 'last'=>'Smith'),
+ * array('id'=>2, 'first'=>'Mary', 'last'=>'Denver'),
+ * array('id'=>3, 'first'=>'Charlie', 'last'=>'Rose')
+ * ),
+ * array('ID', 'First Name', 'Last Name')
+ * );
+ *
+ * @class Table
+ * @extends NodeContainer
+ * @constructor
+ * @param {Array} data The collection of Dictionary objects
+ * @param {Array} [headers=null] An optional collection of header labels for each value
+ * @param {String} [checkbox=null] If we should add a checkbox to each row, this is the name
+ * of the attribute to use as a value. For instance `array('id'=>2)` is
+ * ` `
+ */
+ class Table extends NodeContainer
+ {
+ public function __construct($data, $headers=null, $checkbox=null)
+ {
+ parent::__construct('table', null, null, 'border');
+
+ if ($headers != null && is_array($headers))
+ {
+ $head = html('thead');
+ $this->addChild($head);
+
+ $row = html('tr');
+
+ if ($checkbox != null)
+ {
+ $row->addChild(html('th', html('span', $checkbox)));
+ }
+
+ foreach($headers as $header)
+ {
+ $row->addChild(html('th', $header));
+ }
+ $head->addChild($row);
+ }
+
+ $body = html('tbody');
+
+ foreach($data as $d)
+ {
+ $row = html('tr');
+
+ if ($checkbox != null)
+ {
+ $td = html('td',
+ html(
+ 'input',
+ 'type=checkbox name='.$checkbox.'[] value='.$d[$checkbox]
+ ),
+ 'class='.$checkbox
+ );
+ $row->addChild($td);
+ }
+ foreach($d as $name=>$value)
+ {
+ if ($name == $checkbox) continue;
+ $td = html('td', $value, 'class='.$name);
+ $row->addChild($td);
+ }
+ $body->addChild($row);
+ }
+ $this->addChild($body);
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/Text.php b/src/Canteen/HTML5/Text.php
new file mode 100644
index 0000000..a6b75cc
--- /dev/null
+++ b/src/Canteen/HTML5/Text.php
@@ -0,0 +1,39 @@
+_tag;
+ }
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/src/Canteen/HTML5/html.php b/src/Canteen/HTML5/html.php
new file mode 100644
index 0000000..7776c7e
--- /dev/null
+++ b/src/Canteen/HTML5/html.php
@@ -0,0 +1,237 @@
+GitHub project.
+ * To install the library simply include `html.php`, this takes care of any autoloading that's needed
+ * for the rest of the library.
+ *
+ * echo html('img src=home.jpg');
+ * echo html('img', 'src=home.jpg');
+ * echo html('a', array('href'=>'about.html'));
+ *
+ *
+ *
+ * @class html
+ * @constructor
+ * @param {String} tag The name of the tag as a string for example 'tr', 'table', can be followed
+ * by CSS selector, e.g. 'a#backButton' or 'a.button'
+ * @param {Dictionary|Node|String|Array} [childrenOrAttributes=null] If the tag is a NodeContainer, this can be an array
+ * of attributes, another html node or some text. If the tag is a single node, this can
+ * be an array or chain of attributes
+ * @param {Dictionary|String} [attributes=null] The attributes list for container tags (e.g., 'class:selected')
+ * @return {Node} Return the html node
+ */
+ function html($tag, $childrenOrAttributes=null, $attributes=null)
+ {
+ // Get the tag ID from the tag string
+ // for instance 'a.button rel=external', a.button is the tagId, the rest are the attributes
+ $endPos = strpos(trim($tag), ' ');
+
+ // The tag attributes
+ $tagAttributes = array();
+
+ // If the tag also has some attributes
+ if ($endPos !== false)
+ {
+ $tagOriginal = $tag;
+ $tag = substr($tag, 0, $endPos);
+ $tagAttributes = Attribute::shorthand(substr($tagOriginal, $endPos + 1));
+ }
+
+ // Match the tag name without the CSS selectors
+ preg_match('/^([a-z1-6]{1,10})(.*)/', $tag, $tagParts);
+
+ // Valid class ane id names must begin with a -, _, or a-z letter
+ preg_match_all('/(\.|\#)\-?[\_a-zA-Z]+[\_a-zA-Z0-9\-]*/', $tagParts[2], $selectors);
+
+ $s = false; // if the html is a single tag like
+ $tag = strtolower($tagParts[1]); // the name of the tag
+ $a = ''; // Valid extra attributes for tags
+ switch($tag)
+ {
+ case 'a': $a = 'href,hreflang,media,rel,target,type'; break;
+ case 'abbr': break;
+ case 'address': break;
+ case 'area': $s = true; $a = 'alt,coords,href,hreflang,media,rel,shape,target,type'; break;
+ case 'article': break;
+ case 'aside': break;
+ case 'audio': $a = 'autoplay,controls,loop,muted,preload,src'; break;
+ case 'b': break;
+ case 'base': $s = true; $a = 'href,target'; break;
+ case 'bdo': break;
+ case 'blockquote': $a = 'cite'; break;
+ case 'body': break;
+ case 'br': $s = true; break;
+ case 'button': $a = 'autofocus,disabled,form,formaction,formenctype,formmethod,formnovalidate,formtarget,name,type,value'; break;
+ case 'canvas': $a = 'height,width'; break;
+ case 'caption': break;
+ case 'cite': break;
+ case 'code': break;
+ case 'col': $s = true; break;
+ case 'colgroup': $a = 'span'; break;
+ case 'command': $s = true; $a = 'checked,disabled,icon,label,radiogroup,type'; break;
+ case 'comment': return new Comment($childrenOrAttributes);
+ case 'doctype': return '';
+ case 'datalist': break;
+ case 'dd': break;
+ case 'del': $a = 'cite,datetime'; break;
+ case 'dfn': break;
+ case 'div': break;
+ case 'dl': break;
+ case 'dt': break;
+ case 'em': break;
+ case 'embed': $s = true; $a = 'height,src,type,width'; break;
+ case 'fieldset': $a = 'disabled,form_id,text'; break;
+ case 'figcaption': break;
+ case 'figure': break;
+ case 'footer': break;
+ case 'form': $a = 'accept,accept-charset,action,autocomplete,enctype,method,name,novalidate,target'; break;
+ case 'h1': break;
+ case 'h2': break;
+ case 'h3': break;
+ case 'h4': break;
+ case 'h5': break;
+ case 'h6': break;
+ case 'head': break;
+ case 'header': break;
+ case 'hgroup': break;
+ case 'hr': $s = true; break;
+ case 'html': $a = 'manifest'; break;
+ case 'img': $s = true; $a = 'alt,crossorigin,height,src,usemap,width'; break;
+ case 'i': break;
+ case 'input': $s = true; $a = 'accept,alt,autocomplete,autofocus,checked,disabled,form,formaction,formenctype,formmethod,formnovalidate,formtarget,height,list,max,maxlength,min,multiple,name,pattern,placeholder,readonly,required,size,src,step,type,value,width'; break;
+ case 'keygen': $s = true; $a = 'autofocus,challenge,disabled,form,keytype,name'; break;
+ case 'label': $a = 'for,form'; break;
+ case 'legend': break;
+ case 'li': break;
+ case 'link': $s = true; $a = 'href,hreflang,media,rel,sizes,type'; break;
+ case 'map': $a = 'name'; break;
+ case 'mark': break;
+ case 'menu': break;
+ case 'meta': $s = true; $a = 'charset,content,http-equiv,name'; break;
+ case 'meter': $a = 'form,heigh,low,max,min,optimum,value'; break;
+ case 'nav': break;
+ case 'noscript': break;
+ case 'object': $a = 'data,form,height,name,type,usemap,width'; break;
+ case 'ol': $a = 'reversed,start,type'; break;
+ case 'optgroup': $a = 'disabled,label'; break;
+ case 'option': $a = 'disabled,label,selected,value'; break;
+ case 'output': $a = 'for,form,name'; break;
+ case 'p': break;
+ case 'param': $s = true; $a = 'name,value'; break;
+ case 'pre': break;
+ case 'progress': $a = 'max,value'; break;
+ case 'q': $a = 'cite'; break;
+ case 'rp': break;
+ case 'rt': break;
+ case 'ruby': break;
+ case 's': break;
+ case 'sample': break;
+ case 'script': $a = 'async,charset,defer,src,type'; break;
+ case 'section': break;
+ case 'select': $a = 'autofocus,disabled,form,multiple,name,required,size'; break;
+ case 'small': break;
+ case 'source': $s = true; $a = 'media,src,type'; break;
+ case 'span': break;
+ case 'strong': break;
+ case 'style': $a = 'media,scoped,type'; break;
+ case 'sub': break;
+ case 'table': $a = 'border'; break;
+ case 'tbody': break;
+ case 'td': $a = 'colspan,headers,scope'; break;
+ case 'text': return new Text($childrenOrAttributes);
+ case 'textarea': $a = 'autofocus,cols,disabled,form,maxlength,name,placeholder,readonly,required,row,wrap'; break;
+ case 'tfoot': break;
+ case 'th': $a = 'colspan,headers,rowspan,scope'; break;
+ case 'thead': break;
+ case 'time': $a = 'datetime'; break;
+ case 'title': break;
+ case 'tr': break;
+ case 'track': $s = true; $a = 'default,kind,label,src,srclang'; break;
+ case 'u': break;
+ case 'ul': break;
+ case 'var': break;
+ case 'video': $a = 'autoplay,controls,height,loop,muted,poster,preload,src,width'; break;
+ case 'wbr': $s = true; break;
+ default:
+ throw new HTML5Error(HTML5Error::INVALID_TAG, $tag);
+ break;
+ }
+
+ // Create the attributes collection, either string or array
+ $attributes = $s ? $childrenOrAttributes : $attributes;
+
+ // If there are attributes and they are in a string format
+ // convert to an attributes array
+ if ($attributes !== null && is_string($attributes))
+ {
+ $attributes = Attribute::shorthand($attributes);
+ }
+
+ // Combine the attributes and the tags
+ if (is_array($attributes))
+ {
+ $attributes = array_merge($tagAttributes, $attributes);
+ }
+ // Or just add any tag attributes
+ else if (count($tagAttributes))
+ {
+ $attributes = $tagAttributes;
+ }
+
+ // Create the node or container
+ $node = ($s) ?
+ new Node($tag, $attributes, $a) :
+ new NodeContainer($tag, $childrenOrAttributes, $attributes, $a);
+
+ // Take the selectors convert them into id or class
+ foreach($selectors[0] as $selector)
+ {
+ switch($selector[0])
+ {
+ case '#' :
+ $node->id = substr($selector, 1);
+ break;
+ case '.' :
+ if ($node->class) $node->class .= ' ';
+ $node->class .= substr($selector, 1);
+ break;
+ }
+ }
+
+ return $node;
+ }
+
+?>
\ No newline at end of file