Use npm modules for the build chain so we can concat multiple files for dependencies. Break SelectParser into it's own file. Commit updates to the actual Javascripts to reflect the new builds.
This commit is contained in:
parent
f444fb9e38
commit
6f0f0bd4c3
74
Cakefile
74
Cakefile
|
@ -1,38 +1,62 @@
|
|||
# Building Chosen requires coffee-script and uglify-js. For
|
||||
# help installing, try:
|
||||
#
|
||||
# `npm -g install coffee-script uglify-js`
|
||||
#
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
{spawn, exec} = require 'child_process'
|
||||
CoffeeScript = require 'coffee-script'
|
||||
{parser, uglify} = require 'uglify-js'
|
||||
|
||||
javascripts = [
|
||||
'chosen/chosen.jquery.js', 'chosen/chosen.proto.js'
|
||||
]
|
||||
javascripts = {
|
||||
'chosen/chosen.jquery.js': [
|
||||
'coffee/chosen/select-parser.coffee'
|
||||
'coffee/chosen.jquery.coffee'
|
||||
]
|
||||
'chosen/chosen.proto.js': [
|
||||
'coffee/chosen/select-parser.coffee'
|
||||
'coffee/chosen.proto.coffee'
|
||||
]
|
||||
}
|
||||
|
||||
# Run a command
|
||||
Array::unique = ->
|
||||
output = {}
|
||||
output[@[key]] = @[key] for key in [0...@length]
|
||||
value for key, value of output
|
||||
|
||||
# Gather a list of unique source files.
|
||||
#
|
||||
run = (cmd, args, cb) ->
|
||||
proc = spawn cmd, args
|
||||
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
|
||||
proc.on 'exit', (status) ->
|
||||
process.exit(1) if status != 0
|
||||
cb() if typeof cb is 'function'
|
||||
source_files = ->
|
||||
all_sources = []
|
||||
for javascript, sources of javascripts
|
||||
for source in sources
|
||||
all_sources.push source
|
||||
all_sources.unique()
|
||||
|
||||
coffescript_files = ->
|
||||
'coffee/' + file for file in (fs.readdirSync 'coffee') when file.match(/\.coffee$/)
|
||||
|
||||
# Build Chosen. Requires `coffee` and `uglifyjs`.
|
||||
# Build Chosen.
|
||||
#
|
||||
task 'build', 'build Chosen from source', build = (cb) ->
|
||||
run 'coffee', ['-c', '-o', 'chosen'].concat(coffescript_files()), ->
|
||||
cb() if typeof cb is 'function'
|
||||
for javascript, sources of javascripts
|
||||
code = ''
|
||||
for source in sources
|
||||
code += CoffeeScript.compile "\n#{fs.readFileSync source}"
|
||||
fs.writeFileSync javascript, code
|
||||
unless process.env.MINIFY is 'false'
|
||||
for javascript in javascripts
|
||||
uglified = javascript.replace /\.js$/, '.min.js'
|
||||
run 'uglifyjs', ['-o', uglified, javascript], cb
|
||||
fs.writeFileSync javascript.replace(/\.js$/,'.min.js'), (
|
||||
uglify.gen_code uglify.ast_squeeze uglify.ast_mangle parser.parse code
|
||||
)
|
||||
cb() if typeof cb is 'function'
|
||||
|
||||
task 'watch', 'watch coffee/ for changes and build Chosen', ->
|
||||
console.log "Watching for changes in coffee/"
|
||||
for file in coffescript_files()
|
||||
fs.watchFile file, (curr, prev) ->
|
||||
if +curr.mtime isnt +prev.mtime
|
||||
console.log "Saw change in #{file}"
|
||||
invoke 'build'
|
||||
|
||||
for file in source_files()
|
||||
# Coffeescript wasn't scoping file correctly-
|
||||
# without this closure the file name displayed
|
||||
# is incorrect.
|
||||
((file) ->
|
||||
fs.watchFile file, (curr, prev) ->
|
||||
if +curr.mtime isnt +prev.mtime
|
||||
console.log "Saw change in #{file}"
|
||||
invoke 'build'
|
||||
)(file)
|
||||
|
|
|
@ -1,3 +1,75 @@
|
|||
(function() {
|
||||
var SelectParser;
|
||||
SelectParser = (function() {
|
||||
function SelectParser() {
|
||||
this.options_index = 0;
|
||||
this.parsed = [];
|
||||
}
|
||||
SelectParser.prototype.add_node = function(child) {
|
||||
if (child.nodeName === "OPTGROUP") {
|
||||
return this.add_group(child);
|
||||
} else {
|
||||
return this.add_option(child);
|
||||
}
|
||||
};
|
||||
SelectParser.prototype.add_group = function(group) {
|
||||
var group_position, option, _i, _len, _ref, _results;
|
||||
group_position = this.parsed.length;
|
||||
this.parsed.push({
|
||||
array_index: group_position,
|
||||
group: true,
|
||||
label: group.label,
|
||||
children: 0,
|
||||
disabled: group.disabled
|
||||
});
|
||||
_ref = group.childNodes;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
_results.push(this.add_option(option, group_position, group.disabled));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
||||
if (option.nodeName === "OPTION") {
|
||||
if (option.text !== "") {
|
||||
if (group_position != null) {
|
||||
this.parsed[group_position].children += 1;
|
||||
}
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
value: option.value,
|
||||
text: option.text,
|
||||
html: option.innerHTML,
|
||||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
empty: true
|
||||
});
|
||||
}
|
||||
return this.options_index += 1;
|
||||
}
|
||||
};
|
||||
return SelectParser;
|
||||
})();
|
||||
SelectParser.select_to_array = function(select) {
|
||||
var child, parser, _i, _len, _ref;
|
||||
parser = new SelectParser();
|
||||
_ref = select.childNodes;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
child = _ref[_i];
|
||||
parser.add_node(child);
|
||||
}
|
||||
return parser.parsed;
|
||||
};
|
||||
this.SelectParser = SelectParser;
|
||||
}).call(this);
|
||||
(function() {
|
||||
/*
|
||||
Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||
|
@ -6,9 +78,9 @@
|
|||
Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
Copyright (c) 2011 by Harvest
|
||||
*/ var $, Chosen, SelectParser, get_side_border_padding, root;
|
||||
*/ var $, Chosen, get_side_border_padding, root;
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
root = typeof exports !== "undefined" && exports !== null ? exports : this;
|
||||
root = this;
|
||||
$ = jQuery;
|
||||
$.fn.extend({
|
||||
chosen: function(data, options) {
|
||||
|
@ -210,7 +282,7 @@
|
|||
var content, data, startTime, _i, _len, _ref;
|
||||
startTime = new Date();
|
||||
this.parsing = true;
|
||||
this.results_data = SelectParser.select_to_array(this.form_field);
|
||||
this.results_data = root.SelectParser.select_to_array(this.form_field);
|
||||
if (this.is_multiple && this.choices > 0) {
|
||||
this.search_choices.find("li.search-choice").remove();
|
||||
this.choices = 0;
|
||||
|
@ -705,73 +777,4 @@
|
|||
return side_border_padding = elmt.outerWidth() - elmt.width();
|
||||
};
|
||||
root.get_side_border_padding = get_side_border_padding;
|
||||
SelectParser = (function() {
|
||||
function SelectParser() {
|
||||
this.options_index = 0;
|
||||
this.parsed = [];
|
||||
}
|
||||
SelectParser.prototype.add_node = function(child) {
|
||||
if (child.nodeName === "OPTGROUP") {
|
||||
return this.add_group(child);
|
||||
} else {
|
||||
return this.add_option(child);
|
||||
}
|
||||
};
|
||||
SelectParser.prototype.add_group = function(group) {
|
||||
var group_position, option, _i, _len, _ref, _results;
|
||||
group_position = this.parsed.length;
|
||||
this.parsed.push({
|
||||
array_index: group_position,
|
||||
group: true,
|
||||
label: group.label,
|
||||
children: 0,
|
||||
disabled: group.disabled
|
||||
});
|
||||
_ref = group.childNodes;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
_results.push(this.add_option(option, group_position, group.disabled));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
||||
if (option.nodeName === "OPTION") {
|
||||
if (option.text !== "") {
|
||||
if (group_position != null) {
|
||||
this.parsed[group_position].children += 1;
|
||||
}
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
value: option.value,
|
||||
text: option.text,
|
||||
html: option.innerHTML,
|
||||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
empty: true
|
||||
});
|
||||
}
|
||||
return this.options_index += 1;
|
||||
}
|
||||
};
|
||||
return SelectParser;
|
||||
})();
|
||||
SelectParser.select_to_array = function(select) {
|
||||
var child, parser, _i, _len, _ref;
|
||||
parser = new SelectParser();
|
||||
_ref = select.childNodes;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
child = _ref[_i];
|
||||
parser.add_node(child);
|
||||
}
|
||||
return parser.parsed;
|
||||
};
|
||||
root.SelectParser = SelectParser;
|
||||
}).call(this);
|
||||
|
|
10
chosen/chosen.jquery.min.js
vendored
10
chosen/chosen.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,75 @@
|
|||
(function() {
|
||||
var SelectParser;
|
||||
SelectParser = (function() {
|
||||
function SelectParser() {
|
||||
this.options_index = 0;
|
||||
this.parsed = [];
|
||||
}
|
||||
SelectParser.prototype.add_node = function(child) {
|
||||
if (child.nodeName === "OPTGROUP") {
|
||||
return this.add_group(child);
|
||||
} else {
|
||||
return this.add_option(child);
|
||||
}
|
||||
};
|
||||
SelectParser.prototype.add_group = function(group) {
|
||||
var group_position, option, _i, _len, _ref, _results;
|
||||
group_position = this.parsed.length;
|
||||
this.parsed.push({
|
||||
array_index: group_position,
|
||||
group: true,
|
||||
label: group.label,
|
||||
children: 0,
|
||||
disabled: group.disabled
|
||||
});
|
||||
_ref = group.childNodes;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
_results.push(this.add_option(option, group_position, group.disabled));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
||||
if (option.nodeName === "OPTION") {
|
||||
if (option.text !== "") {
|
||||
if (group_position != null) {
|
||||
this.parsed[group_position].children += 1;
|
||||
}
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
value: option.value,
|
||||
text: option.text,
|
||||
html: option.innerHTML,
|
||||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
empty: true
|
||||
});
|
||||
}
|
||||
return this.options_index += 1;
|
||||
}
|
||||
};
|
||||
return SelectParser;
|
||||
})();
|
||||
SelectParser.select_to_array = function(select) {
|
||||
var child, parser, _i, _len, _ref;
|
||||
parser = new SelectParser();
|
||||
_ref = select.childNodes;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
child = _ref[_i];
|
||||
parser.add_node(child);
|
||||
}
|
||||
return parser.parsed;
|
||||
};
|
||||
this.SelectParser = SelectParser;
|
||||
}).call(this);
|
||||
(function() {
|
||||
/*
|
||||
Chosen, a Select Box Enhancer for jQuery and Protoype
|
||||
|
@ -6,9 +78,9 @@
|
|||
Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
Copyright (c) 2011 by Harvest
|
||||
*/ var Chosen, SelectParser, get_side_border_padding, root;
|
||||
*/ var Chosen, get_side_border_padding, root;
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
root = typeof exports !== "undefined" && exports !== null ? exports : this;
|
||||
root = this;
|
||||
Chosen = (function() {
|
||||
function Chosen(elmn) {
|
||||
this.set_default_values();
|
||||
|
@ -198,7 +270,7 @@
|
|||
var content, data, startTime, _i, _len, _ref;
|
||||
startTime = new Date();
|
||||
this.parsing = true;
|
||||
this.results_data = SelectParser.select_to_array(this.form_field);
|
||||
this.results_data = root.SelectParser.select_to_array(this.form_field);
|
||||
if (this.is_multiple && this.choices > 0) {
|
||||
this.search_choices.select("li.search-choice").invoke("remove");
|
||||
this.choices = 0;
|
||||
|
@ -676,7 +748,7 @@
|
|||
};
|
||||
return Chosen;
|
||||
})();
|
||||
root.Chosen = Chosen;
|
||||
this.Chosen = Chosen;
|
||||
document.observe('dom:loaded', function(evt) {
|
||||
var select, selects, _i, _len, _results;
|
||||
selects = $$(".chzn-select");
|
||||
|
@ -693,74 +765,4 @@
|
|||
return 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;
|
||||
root = typeof exports !== "undefined" && exports !== null ? exports : this;
|
||||
SelectParser = (function() {
|
||||
function SelectParser() {
|
||||
this.options_index = 0;
|
||||
this.parsed = [];
|
||||
}
|
||||
SelectParser.prototype.add_node = function(child) {
|
||||
if (child.nodeName === "OPTGROUP") {
|
||||
return this.add_group(child);
|
||||
} else {
|
||||
return this.add_option(child);
|
||||
}
|
||||
};
|
||||
SelectParser.prototype.add_group = function(group) {
|
||||
var group_position, option, _i, _len, _ref, _results;
|
||||
group_position = this.parsed.length;
|
||||
this.parsed.push({
|
||||
array_index: group_position,
|
||||
group: true,
|
||||
label: group.label,
|
||||
children: 0,
|
||||
disabled: group.disabled
|
||||
});
|
||||
_ref = group.childNodes;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
option = _ref[_i];
|
||||
_results.push(this.add_option(option, group_position, group.disabled));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
||||
if (option.nodeName === "OPTION") {
|
||||
if (option.text !== "") {
|
||||
if (group_position != null) {
|
||||
this.parsed[group_position].children += 1;
|
||||
}
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
value: option.value,
|
||||
text: option.text,
|
||||
html: option.innerHTML,
|
||||
selected: option.selected,
|
||||
disabled: group_disabled === true ? group_disabled : option.disabled,
|
||||
group_array_index: group_position
|
||||
});
|
||||
} else {
|
||||
this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
empty: true
|
||||
});
|
||||
}
|
||||
return this.options_index += 1;
|
||||
}
|
||||
};
|
||||
return SelectParser;
|
||||
})();
|
||||
SelectParser.select_to_array = function(select) {
|
||||
var child, parser, _i, _len, _ref;
|
||||
parser = new SelectParser();
|
||||
_ref = select.childNodes;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
child = _ref[_i];
|
||||
parser.add_node(child);
|
||||
}
|
||||
return parser.parsed;
|
||||
};
|
||||
root.SelectParser = SelectParser;
|
||||
}).call(this);
|
||||
|
|
10
chosen/chosen.proto.min.js
vendored
10
chosen/chosen.proto.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,7 @@ Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_Licens
|
|||
|
||||
Copyright (c) 2011 by Harvest
|
||||
###
|
||||
|
||||
root = exports ? this
|
||||
root = this
|
||||
$ = jQuery
|
||||
|
||||
$.fn.extend({
|
||||
|
@ -179,7 +178,7 @@ class Chosen
|
|||
results_build: ->
|
||||
startTime = new Date()
|
||||
@parsing = true
|
||||
@results_data = SelectParser.select_to_array @form_field
|
||||
@results_data = root.SelectParser.select_to_array @form_field
|
||||
|
||||
if @is_multiple and @choices > 0
|
||||
@search_choices.find("li.search-choice").remove()
|
||||
|
@ -599,53 +598,3 @@ get_side_border_padding = (elmt) ->
|
|||
side_border_padding = elmt.outerWidth() - elmt.width()
|
||||
|
||||
root.get_side_border_padding = get_side_border_padding
|
||||
|
||||
class SelectParser
|
||||
|
||||
constructor: ->
|
||||
@options_index = 0
|
||||
@parsed = []
|
||||
|
||||
add_node: (child) ->
|
||||
if child.nodeName is "OPTGROUP"
|
||||
this.add_group child
|
||||
else
|
||||
this.add_option child
|
||||
|
||||
add_group: (group) ->
|
||||
group_position = @parsed.length
|
||||
@parsed.push
|
||||
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
|
||||
@parsed.push
|
||||
array_index: @parsed.length
|
||||
options_index: @options_index
|
||||
value: option.value
|
||||
text: option.text
|
||||
html: option.innerHTML
|
||||
selected: option.selected
|
||||
disabled: if group_disabled is true then group_disabled else option.disabled
|
||||
group_array_index: group_position
|
||||
else
|
||||
@parsed.push
|
||||
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
|
||||
parser.parsed
|
||||
|
||||
root.SelectParser = SelectParser
|
||||
|
|
|
@ -6,8 +6,7 @@ Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_Licens
|
|||
|
||||
Copyright (c) 2011 by Harvest
|
||||
###
|
||||
|
||||
root = exports ? this
|
||||
root = this
|
||||
|
||||
class Chosen
|
||||
|
||||
|
@ -172,7 +171,7 @@ class Chosen
|
|||
results_build: ->
|
||||
startTime = new Date()
|
||||
@parsing = true
|
||||
@results_data = SelectParser.select_to_array @form_field
|
||||
@results_data = root.SelectParser.select_to_array @form_field
|
||||
|
||||
if @is_multiple and @choices > 0
|
||||
@search_choices.select("li.search-choice").invoke("remove")
|
||||
|
@ -580,55 +579,3 @@ get_side_border_padding = (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
|
||||
|
||||
root = exports ? this
|
||||
|
||||
class SelectParser
|
||||
|
||||
constructor: ->
|
||||
@options_index = 0
|
||||
@parsed = []
|
||||
|
||||
add_node: (child) ->
|
||||
if child.nodeName is "OPTGROUP"
|
||||
this.add_group child
|
||||
else
|
||||
this.add_option child
|
||||
|
||||
add_group: (group) ->
|
||||
group_position = @parsed.length
|
||||
@parsed.push
|
||||
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
|
||||
@parsed.push
|
||||
array_index: @parsed.length
|
||||
options_index: @options_index
|
||||
value: option.value
|
||||
text: option.text
|
||||
html: option.innerHTML
|
||||
selected: option.selected
|
||||
disabled: if group_disabled is true then group_disabled else option.disabled
|
||||
group_array_index: group_position
|
||||
else
|
||||
@parsed.push
|
||||
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
|
||||
parser.parsed
|
||||
|
||||
root.SelectParser = SelectParser
|
||||
|
|
49
coffee/chosen/select-parser.coffee
Normal file
49
coffee/chosen/select-parser.coffee
Normal file
|
@ -0,0 +1,49 @@
|
|||
class SelectParser
|
||||
|
||||
constructor: ->
|
||||
@options_index = 0
|
||||
@parsed = []
|
||||
|
||||
add_node: (child) ->
|
||||
if child.nodeName is "OPTGROUP"
|
||||
this.add_group child
|
||||
else
|
||||
this.add_option child
|
||||
|
||||
add_group: (group) ->
|
||||
group_position = @parsed.length
|
||||
@parsed.push
|
||||
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
|
||||
@parsed.push
|
||||
array_index: @parsed.length
|
||||
options_index: @options_index
|
||||
value: option.value
|
||||
text: option.text
|
||||
html: option.innerHTML
|
||||
selected: option.selected
|
||||
disabled: if group_disabled is true then group_disabled else option.disabled
|
||||
group_array_index: group_position
|
||||
else
|
||||
@parsed.push
|
||||
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
|
||||
parser.parsed
|
||||
|
||||
this.SelectParser = SelectParser
|
Loading…
Reference in a new issue