// helper functions to make all input elements
define([
    "jquery",
    "../core/logger"
], function($, logging) {
    var namespace = "input-change-events",
        log = logging.getLogger(namespace);

    var _ = {
        setup: function($form, pat) {

            if (!$form.is("form")) {
                log.error("Input change event handler can only be set on forms.");
                return;
            }

            if (!pat) {
                log.error("The name of the calling pattern has to be set.");
                return;
            }

            // list of patterns that installed input-change-event handlers
            var patterns = $form.data(namespace) || [];
            log.debug("setup handlers for " + pat);

            if (!patterns.length) {
                log.debug("installing handlers");

                $form.find(":input").each(function() {
                    var $el = $(this),
                        isText = $el.is("input:text, input[type=search], textarea");

                    if (isText) {
                        if ("oninput" in window) {
                            $el.on("input." + namespace, function() {
                                log.debug('translating input');
                                $el.trigger("input-change");
                            });
                        } else {
                            // this is the legacy code path for IE8
                            $el.on("propertychange." + namespace, function(ev) {
                                if (ev.originalEvent.propertyName === 'value') {
                                    log.debug('translating propertychange');
                                    $el.trigger("input-change");
                                }
                            });
                        }
                    } else {
                        $el.on("change." + namespace, function() {
                            log.debug('translating change');
                            $el.trigger("input-change");
                        });
                    }
                });
            }

            if (patterns.indexOf(pat) === -1) {
                patterns.push(pat);
                $form.data(namespace, patterns);
            }
        },

        remove: function($form, pat) {
            var patterns = $form.data(namespace) || [];
            if (patterns.indexOf(pat) === -1) {
                log.warn("input-change-events were never installed for " + pat);
            } else {
                patterns = patterns.filter(function(e){return e!==pat;});
                if (patterns.length) {
                    $form.data(namespace, patterns);
                } else {
                    log.debug('remove handlers');
                    $form.removeData(namespace);
                    $form.find(':input').off('.' + namespace);
                }
            }
        }
    };

    return _;

});

// jshint indent: 4, browser: true, jquery: true, quotmark: double
// vim: sw=4 expandtab

@@ -1446,30 +1446,310 @@
     
-$el.on(%22propertychange
+// XXX: propertychange would be more appropriate,%0A                            // but has problems with the placeholder polyfill.%0A                            // Maybe minimize use of 'keyup' by checking if %0A                            // there is a placeholder.%0A                            $el.on(%22keyup
 .%22 +

Use keyup instead of propertychange for now.