Bug 1446342 - Input type="date" not working if the other form elements has name="document" (any alternative solution)

This commit is contained in:
janekptacijarabaci 2018-03-31 11:05:38 +02:00 • committed by Roy Tam
commit 9c7b814103

View file

@ -9,6 +9,16 @@
%datetimeboxDTD; %datetimeboxDTD;
]> ]>
<!--
TODO
Bug 1446342:
Input type="date" not working if the other form elements has name="document"
Any alternative solution:
document === window.document
document === this.ownerDocument
-->
<bindings id="datetimeboxBindings" <bindings id="datetimeboxBindings"
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"
@ -48,11 +58,11 @@
// Default to en-US, month-day-year order. // Default to en-US, month-day-year order.
this.mMonthField = this.mMonthField =
document.getAnonymousElementByAttribute(this, "anonid", "input-one"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
this.mDayField = this.mDayField =
document.getAnonymousElementByAttribute(this, "anonid", "input-two"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
this.mYearField = this.mYearField =
document.getAnonymousElementByAttribute(this, "anonid", "input-three"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
this.mYearField.size = this.mYearLength; this.mYearField.size = this.mYearLength;
this.mYearField.maxLength = this.mMaxYear.toString().length; this.mYearField.maxLength = this.mMaxYear.toString().length;
@ -73,10 +83,10 @@
this.mYearPageUpDownInterval); this.mYearPageUpDownInterval);
this.mDaySeparator = this.mDaySeparator =
document.getAnonymousElementByAttribute(this, "anonid", "sep-first"); window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
this.mDaySeparator.textContent = this.mSeparatorText; this.mDaySeparator.textContent = this.mSeparatorText;
this.mYearSeparator = this.mYearSeparator =
document.getAnonymousElementByAttribute(this, "anonid", "sep-second"); window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
this.mYearSeparator.textContent = this.mSeparatorText; this.mYearSeparator.textContent = this.mSeparatorText;
if (this.mInputElement.value) { if (this.mInputElement.value) {
@ -489,13 +499,13 @@
this.mMinSecPageUpDownInterval = 10; this.mMinSecPageUpDownInterval = 10;
this.mHourField = this.mHourField =
document.getAnonymousElementByAttribute(this, "anonid", "input-one"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
this.mHourField.setAttribute("typeBuffer", ""); this.mHourField.setAttribute("typeBuffer", "");
this.mMinuteField = this.mMinuteField =
document.getAnonymousElementByAttribute(this, "anonid", "input-two"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
this.mMinuteField.setAttribute("typeBuffer", ""); this.mMinuteField.setAttribute("typeBuffer", "");
this.mDayPeriodField = this.mDayPeriodField =
document.getAnonymousElementByAttribute(this, "anonid", "input-three"); window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
this.mDayPeriodField.classList.remove("numeric"); this.mDayPeriodField.classList.remove("numeric");
this.mHourField.placeholder = this.mPlaceHolder; this.mHourField.placeholder = this.mPlaceHolder;
@ -508,10 +518,10 @@
this.mMinuteField.setAttribute("max", this.mMaxMinute); this.mMinuteField.setAttribute("max", this.mMaxMinute);
this.mMinuteSeparator = this.mMinuteSeparator =
document.getAnonymousElementByAttribute(this, "anonid", "sep-first"); window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
this.mMinuteSeparator.textContent = this.mSeparatorText; this.mMinuteSeparator.textContent = this.mSeparatorText;
this.mSpaceSeparator = this.mSpaceSeparator =
document.getAnonymousElementByAttribute(this, "anonid", "sep-second"); window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
// space between time and am/pm field // space between time and am/pm field
this.mSpaceSeparator.textContent = " "; this.mSpaceSeparator.textContent = " ";
@ -1062,7 +1072,7 @@
this.mIsPickerOpen = false; this.mIsPickerOpen = false;
this.mResetButton = this.mResetButton =
document.getAnonymousElementByAttribute(this, "anonid", "reset-button"); window.document.getAnonymousElementByAttribute(this, "anonid", "reset-button");
this.EVENTS.forEach((eventName) => { this.EVENTS.forEach((eventName) => {
this.addEventListener(eventName, this, { mozSystemGroup: true }); this.addEventListener(eventName, this, { mozSystemGroup: true });
@ -1130,7 +1140,7 @@
<body> <body>
<![CDATA[ <![CDATA[
this.log("focusInnerTextBox"); this.log("focusInnerTextBox");
document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus(); window.document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus();
]]> ]]>
</body> </body>
</method> </method>