From a639d4eb2320e91620000b849facb63d0d43c0d6 Mon Sep 17 00:00:00 2001 From: Paul Makepeace Date: Tue, 12 Feb 2013 16:24:51 -0800 Subject: [PATCH] Add a element --- source/elements.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/source/elements.js b/source/elements.js index a864798..2578cca 100644 --- a/source/elements.js +++ b/source/elements.js @@ -254,27 +254,20 @@ with (scope()) { return this[options.type || 'text'](options, arguments); }); - define('submit', function() { - var arguments = flatten_to_array(arguments); - var options = shift_options_from_args(arguments); - options.type = 'submit'; - if (!options.value && arguments.length == 1) options.value = arguments.pop(); - return element('input', options, arguments); - }); - - // input types for_each( - 'text', 'hidden', 'password', 'checkbox', 'radio', 'search', 'range', 'number', - function(input_type) { - define(input_type, function() { - var arguments = flatten_to_array(arguments); - var options = shift_options_from_args(arguments); - options.type = input_type; - - return element('input', options, arguments); - }); - } - ); + 'text', 'hidden', 'password', 'checkbox', 'radio', 'search', 'range', 'number', 'reset', 'submit', + function(input_type) { + define(input_type, function() { + var arguments = flatten_to_array(arguments); + var options = shift_options_from_args(arguments); + options.type = input_type; + if (input_type == 'submit' || input_type == 'reset') + if (!options.value && arguments.length == 1) + options.value = arguments.pop(); + return element('input', options, arguments); + }); + } + ); // remove a DOM element define('remove_element', function(id) {