1 HTMLInputElement.prototype._replicate = function() {
3 this.replica.value = this.value;
4 var onReplicaChangeEvent = document.createEvent("Event");
5 onReplicaChangeEvent.initEvent("change", true, true);
6 this.replica.dispatchEvent(onReplicaChangeEvent);
10 HTMLInputElement.prototype.assignReplica = function(otherInput) {
11 if (!this._onChangeBound) {
12 this.addEventListener("change", this._replicate, false);
13 this._onChangeBound = true;
15 this.replica = otherInput;
18 HTMLInputElement.prototype.valueAsDate = function () {
19 return this.value.asDate();
22 HTMLInputElement.prototype.setValueAsDate = function(dateValue) {
23 if (!this.dateSeparator)
24 this._detectDateSeparator();
25 this.value = dateValue.stringWithSeparator(this.dateSeparator);
28 HTMLInputElement.prototype.updateShadowValue = function () {
29 this.setAttribute("shadow-value", this.value);
32 HTMLInputElement.prototype._detectDateSeparator = function() {
33 var date = this.value.split("/");
35 this.dateSeparator = "/";
37 this.dateSeparator = "-";
40 HTMLInputElement.prototype.valueAsShortDateString = function() {
43 if (!this.dateSeparator)
44 this._detectDateSeparator();
46 var date = this.value.split(this.dateSeparator);
47 if (this.dateSeparator == '/')
48 dateStr += date[2] + date[1] + date[0];
50 dateStr += date[0] + date[1] + date[2];
55 /* "select" is part of the inputs so it's included here */
56 HTMLSelectElement.prototype._replicate = function() {
58 this.replica.value = this.value;
59 var onReplicaChangeEvent = document.createEvent("Event");
60 onReplicaChangeEvent.initEvent("change", true, true);
61 this.replica.dispatchEvent(onReplicaChangeEvent);
65 HTMLSelectElement.prototype.assignReplica = function(otherSelect) {
66 if (!this._onChangeBound) {
67 this.addEventListener("change", this._replicate, false);
68 this._onChangeBound = true;
70 this.replica = otherSelect;
73 HTMLSelectElement.prototype.updateShadowValue = function () {
74 this.setAttribute("shadow-value", this.value);