Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2212581b61
Fetching contributors…

Cannot retrieve contributors at this time

56 lines (47 sloc) 1.647 kb
root = exports ? this
class SelectParser
constructor: ->
@options_index = 0
@parsed = []
add_node: (child) ->
if child.nodeName is "OPTGROUP"
this.add_group child
this.add_option child
add_group: (group) ->
group_position = @parsed.length
array_index: group_position
group: true
label: group.label
children: 0
disabled: group.disabled
this.add_option( option, group_position, group.disabled ) for option in group.childNodes
add_option: (option, group_position, group_disabled) ->
if option.nodeName is "OPTION"
if option.text != ""
if group_position?
@parsed[group_position].children += 1
array_index: @parsed.length
options_index: @options_index
value: option.value
text: option.text
selected: option.selected
disabled: ((group_disabled is true) ? group_disabled : option.disabled)
group_array_index: group_position
array_index: @parsed.length
options_index: @options_index
empty: true
@options_index += 1
SelectParser.select_to_array = (select) ->
parser = new SelectParser()
parser.add_node( child ) for child in select.childNodes
root.SelectParser = SelectParser
get_side_border_padding = (elmt) ->
layout = new Element.layout(elmt)
side_border_padding = layout.get("border-left") + layout.get("border-right") + layout.get("padding-left") + layout.get("padding-right")
root.get_side_border_padding = get_side_border_padding
Jump to Line
Something went wrong with that request. Please try again.