html.js

Summary
html.js
bbop.htmlRight now contains bbop.html.tag, but all html producing functions should go in here somewhere.
bbop.html.tag
Functions
tagCreate the fundamental tag object to work with and extend.
to_stringConvert a tag object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.
bbop.html.accordion
Functions
accordionCreate the a frame for the functional part of a jQuery accordion structure.
to_stringConvert the accordion object into a html-ized string.
add_toAdd a contect section to the accordion.
emptyEmpty all sections from the accordion.
get_idReturn the id if extant, null otherwise.
get_section_idGet the “real” section id by way of the “convenience” section id?
bbop.html.list
Functions
listCreate the a frame for an unordered list object.
to_stringConvert a list object into a html-ized string.
add_toAdd a new li section to a list.
emptyRemove all content (li’s) from the list.
get_idReturn the id if extant, null otherwise.
bbop.html.input
Functions
inputCreate a form input.
to_stringConvert an input into a html-ized string.
add_toAdd content between the input tags.
emptyReset/remove all children.
get_idReturn the id if extant, null otherwise.
bbop.html.anchor
Functions
anchorCreate an anchor object.
to_stringConvert an anchor object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.
bbop.html.image
Functions
imageCreate an image (img) object.
to_stringConvert an image object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.
bbop.html.table
Functions
tableCreate a simple table structure.
to_stringConvert a table object into a html-ized string.
add_toAdd data row.
emptyHeaders do not get wiped, just the data rows in the tbody.
get_idReturn the id if extant, null otherwise.
bbop.html.button
Functions
buttonCreate a button object.
to_stringConvert a button object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.
bbop.html.span
Functions
spanCreate a span object.
to_stringConvert a span object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

bbop.html

Right now contains bbop.html.tag, but all html producing functions should go in here somewhere.

All bbop.html implement the interface

.to_string(): returns a string of you and below .add_to(): add things between the tags .empty(): empties all things between the tags .get_id(): return the id or null if not defined These are enforced during the tests.

For functions that take attribute hashes, there is a special attribute {‘generate_id’: true} that will generate a somewhat random id if an incoming id was not already specified.  This id can be retrieved using get_id().

This package takes all of the bbop.html.* namespace.

bbop.html.tag

Summary
Functions
tagCreate the fundamental tag object to work with and extend.
to_stringConvert a tag object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

Functions

tag

bbop.html.tag = function(tag,
attrs,
below)

Create the fundamental tag object to work with and extend.

Parameters

tagthe tag name to be created
attrs[serially optional] the typical attributes to add
below[optional] a list/array of other html objects that exists “between” the tags

Returns

bbop.html.tag object

to_string

bbop.html.tag.prototype.to_string = function()

Convert a tag object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.tag.prototype.add_to = function(bbop_html_tag_or_string)

Add content between the tags.  Order of addition is order of output.

Parameters

bbop_html_tag_or_stringanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.tag.prototype.empty = function()

Remove all content between the tags.

Parameters: n/a

Returns: n/a

get_id

bbop.html.tag.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.accordion

Summary
Functions
accordionCreate the a frame for the functional part of a jQuery accordion structure.
to_stringConvert the accordion object into a html-ized string.
add_toAdd a contect section to the accordion.
emptyEmpty all sections from the accordion.
get_idReturn the id if extant, null otherwise.
get_section_idGet the “real” section id by way of the “convenience” section id?

Functions

accordion

bbop.html.accordion = function(in_list,
attrs,
add_id_p)

Create the a frame for the functional part of a jQuery accordion structure.

Input:
 [[title, string/*.to_string()], ...]

Output:
 <div id="accordion">
  <h3><a href="#">Section 1</a></h3>
  <div>
   <p>
    foo
   </p>
  </div>
  ...
 </div>

Parameters

in_listaccordion frame headers: [[title, string/*.to_string()], ...]
attrs[serially optional] attributes to apply to the new top-level div
add_id_p[optional] true or false; add a random id to each section

Returns

bbop.html.accordion object

Also see: tag

to_string

bbop.html.accordion.prototype.to_string = function()

Convert the accordion object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.accordion.prototype.add_to = function(section_info,
content_blob,
add_id_p)

Add a contect section to the accordion.

Parameters

section_infoa string or a hash with ‘id’, ‘label’, and ‘description’
content_blobstring or bbop.html object to put in a section
add_id_p[optional] true or false; add a random id to the section

Returns: n/a

empty

bbop.html.accordion.prototype.empty = function()

Empty all sections from the accordion.

Parameters: n/a

Returns: n/a

get_id

bbop.html.accordion.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

get_section_id

bbop.html.accordion.prototype.get_section_id = function(sect_id)

Get the “real” section id by way of the “convenience” section id?

Parameters

sect_idTODO ???

Returns: TODO ???

bbop.html.list

Summary
Functions
listCreate the a frame for an unordered list object.
to_stringConvert a list object into a html-ized string.
add_toAdd a new li section to a list.
emptyRemove all content (li’s) from the list.
get_idReturn the id if extant, null otherwise.

Functions

list

bbop.html.list = function(in_list,
attrs)

Create the a frame for an unordered list object.

Input:
 [string/*.to_string(), ...]

Output:
 <ul id="list">
  <li>foo</li>
   ...
 </ul>

Parameters

in_listlist of strings/bbop.html objects to be li separated
attrs[optional] attributes to apply to the new top-level ul

Returns

bbop.html.list object

Also see: tag

to_string

bbop.html.list.prototype.to_string = function()

Convert a list object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.list.prototype.add_to = function()

Add a new li section to a list.

Optionally, it can take multiple arguments and will add each of them to the new li tag in turn.

Parameters

item1another tag object or a string (html or otherwise)
item2[optional] ...on forever

Returns: n/a

empty

bbop.html.list.prototype.empty = function()

Remove all content (li’s) from the list.

Parameters: n/a

Returns: n/a

get_id

bbop.html.list.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.input

Summary
Functions
inputCreate a form input.
to_stringConvert an input into a html-ized string.
add_toAdd content between the input tags.
emptyReset/remove all children.
get_idReturn the id if extant, null otherwise.

Functions

input

bbop.html.input = function(attrs)

Create a form input.

Parameters

attrs[optional] the typical attributes to add

Returns

bbop.html.input object

to_string

bbop.html.input.prototype.to_string = function()

Convert an input into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.input.prototype.add_to = function(item)

Add content between the input tags.

Parameters

itemanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.input.prototype.empty = function()

Reset/remove all children.

Parameters: n/a

Returns: n/a

get_id

bbop.html.input.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.anchor

Summary
Functions
anchorCreate an anchor object.
to_stringConvert an anchor object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

Functions

anchor

bbop.html.anchor = function(in_cont,
in_attrs)

Create an anchor object.  Note: href, title, etc. go through in_attrs.

Parameters

in_contthe contents between the “a” tags
in_attrs[optional] the typical attributes to add

Returns

bbop.html.anchor object

to_string

bbop.html.anchor.prototype.to_string = function()

Convert an anchor object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.anchor.prototype.add_to = function(item)

Add content between the tags.  Order of addition is order of output.

Parameters

itemanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.anchor.prototype.empty = function()

Remove all content between the tags.

Parameters: n/a

Returns: n/a

get_id

bbop.html.anchor.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.image

Summary
Functions
imageCreate an image (img) object.
to_stringConvert an image object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

Functions

image

bbop.html.image = function(in_attrs)

Create an image (img) object.  Note: alt, title, etc. go through in_attrs.

Parameters

in_attrs[optional] the typical attributes to add

Returns

bbop.html.image object

to_string

bbop.html.image.prototype.to_string = function()

Convert an image object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.image.prototype.add_to = function(item)

Add content between the tags.  Order of addition is order of output.

Parameters

itemanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.image.prototype.empty = function()

Remove all content between the tags.

Parameters: n/a

Returns: n/a

get_id

bbop.html.image.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.table

Summary
Functions
tableCreate a simple table structure.
to_stringConvert a table object into a html-ized string.
add_toAdd data row.
emptyHeaders do not get wiped, just the data rows in the tbody.
get_idReturn the id if extant, null otherwise.

Functions

table

bbop.html.table = function(in_headers,
in_entries,
in_attrs)

Create a simple table structure. in_headers is necessary, but can be empty. in_entries is necessary, but can be empty.

Parameters

in_headersordered list of headers
in_entrieslists of lists of entry items
in_attrs[optional] the typical attributes to add to the table

Returns

bbop.html.table object

to_string

bbop.html.table.prototype.to_string = function()

Convert a table object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.table.prototype.add_to = function(entries)

Add data row.  The entries argument is coerced into an array of tds.

Parameters

entrieslists of lists of entry items

Returns: n/a

empty

bbop.html.table.prototype.empty = function()

Headers do not get wiped, just the data rows in the tbody.

Parameters: n/a

Returns: n/a

get_id

bbop.html.table.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.button

Summary
Functions
buttonCreate a button object.
to_stringConvert a button object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

Functions

button

bbop.html.button = function(in_label,
in_attrs)

Create a button object.  For after-the-fact decoration, take a look at: https://jquery-ui.googlecode.com/svn/tags/1.6rc5/tests/static/icons.html

Parameters

in_labellabel
in_attrs[optional] the typical attributes to add

Returns

bbop.html.button object

to_string

bbop.html.button.prototype.to_string = function()

Convert a button object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.button.prototype.add_to = function(item)

Add content between the tags.  Order of addition is order of output.  Not really worth much as it just equates to changing the label.

Parameters

itemanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.button.prototype.empty = function()

Remove all content between the tags.  This equates to removing the label.

Parameters: n/a

Returns: n/a

get_id

bbop.html.button.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.span

Summary
Functions
spanCreate a span object.
to_stringConvert a span object into a html-ized string.
add_toAdd content between the tags.
emptyRemove all content between the tags.
get_idReturn the id if extant, null otherwise.

Functions

span

bbop.html.span = function(in_label,
in_attrs)

Create a span object.  Fun for calling live bits after the fact.

Parameters

in_labellabel
in_attrs[optional] the typical attributes to add

Returns

bbop.html.span object

to_string

bbop.html.span.prototype.to_string = function()

Convert a span object into a html-ized string.

Parameters: n/a

Returns

string

add_to

bbop.html.span.prototype.add_to = function(item)

Add content between the tags.  Order of addition is order of output.  Not really worth much as it just equates to changing the label.

Parameters

itemanother tag object or a string (html or otherwise)

Returns: n/a

empty

bbop.html.span.prototype.empty = function()

Remove all content between the tags.  This equates to removing the label.

Parameters: n/a

Returns: n/a

get_id

bbop.html.span.prototype.get_id = function()

Return the id if extant, null otherwise.

Parameters: n/a

Returns: string or null

bbop.html.tag = function(tag,
attrs,
below)
Create the fundamental tag object to work with and extend.
bbop.html.tag.prototype.to_string = function()
Convert a tag object into a html-ized string.
bbop.html.tag.prototype.add_to = function(bbop_html_tag_or_string)
Add content between the tags.
bbop.html.tag.prototype.empty = function()
Remove all content between the tags.
bbop.html.tag.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.accordion = function(in_list,
attrs,
add_id_p)
Create the a frame for the functional part of a jQuery accordion structure.
bbop.html.accordion.prototype.to_string = function()
Convert the accordion object into a html-ized string.
bbop.html.accordion.prototype.add_to = function(section_info,
content_blob,
add_id_p)
Add a contect section to the accordion.
bbop.html.accordion.prototype.empty = function()
Empty all sections from the accordion.
bbop.html.accordion.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.accordion.prototype.get_section_id = function(sect_id)
Get the “real” section id by way of the “convenience” section id?
bbop.html.list = function(in_list,
attrs)
Create the a frame for an unordered list object.
bbop.html.list.prototype.to_string = function()
Convert a list object into a html-ized string.
bbop.html.list.prototype.add_to = function()
Add a new li section to a list.
bbop.html.list.prototype.empty = function()
Remove all content (li’s) from the list.
bbop.html.list.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.input = function(attrs)
Create a form input.
bbop.html.input.prototype.to_string = function()
Convert an input into a html-ized string.
bbop.html.input.prototype.add_to = function(item)
Add content between the input tags.
bbop.html.input.prototype.empty = function()
Reset/remove all children.
bbop.html.input.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.anchor = function(in_cont,
in_attrs)
Create an anchor object.
bbop.html.anchor.prototype.to_string = function()
Convert an anchor object into a html-ized string.
bbop.html.anchor.prototype.add_to = function(item)
Add content between the tags.
bbop.html.anchor.prototype.empty = function()
Remove all content between the tags.
bbop.html.anchor.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.image = function(in_attrs)
Create an image (img) object.
bbop.html.image.prototype.to_string = function()
Convert an image object into a html-ized string.
bbop.html.image.prototype.add_to = function(item)
Add content between the tags.
bbop.html.image.prototype.empty = function()
Remove all content between the tags.
bbop.html.image.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.table = function(in_headers,
in_entries,
in_attrs)
Create a simple table structure.
bbop.html.table.prototype.to_string = function()
Convert a table object into a html-ized string.
bbop.html.table.prototype.add_to = function(entries)
Add data row.
bbop.html.table.prototype.empty = function()
Headers do not get wiped, just the data rows in the tbody.
bbop.html.table.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.button = function(in_label,
in_attrs)
Create a button object.
bbop.html.button.prototype.to_string = function()
Convert a button object into a html-ized string.
bbop.html.button.prototype.add_to = function(item)
Add content between the tags.
bbop.html.button.prototype.empty = function()
Remove all content between the tags.
bbop.html.button.prototype.get_id = function()
Return the id if extant, null otherwise.
bbop.html.span = function(in_label,
in_attrs)
Create a span object.
bbop.html.span.prototype.to_string = function()
Convert a span object into a html-ized string.
bbop.html.span.prototype.add_to = function(item)
Add content between the tags.
bbop.html.span.prototype.empty = function()
Remove all content between the tags.
bbop.html.span.prototype.get_id = function()
Return the id if extant, null otherwise.
Close