Closed Bug 926489 Opened 12 years ago Closed 12 years ago

Replace className comparisons with classList.contains in datetimepicker.xml

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: jaws, Assigned: system64)

Details

(Whiteboard: [good first bug][mentor=jaws][lang=js])

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #926487 +++ +++ This bug was initially created as a clone of Bug #926479 +++ +++ This bug was initially created as a clone of Bug #926477 +++ +++ This bug was initially created as a clone of Bug #926471 +++ See the following search for each instance of this: http://mxr.mozilla.org/mozilla-central/search?string=.className+%3D&find=datetimepicker.xml&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central If someone adds a new className to the element, these checks will fail. They should instead be using .classList.contains().
Summary: Replace className comparisons with classList.contains in viewSource.js → Replace className comparisons with classList.contains in datetimepicker.xml
I would love to work on the bug. The other bugs mentioned above also has the same issue I believe. Should I go ahead and work for all the above ?
Assigning to a new contributor by request.
Assignee: nobody → akshayaurora2008
Status: NEW → ASSIGNED
Attached patch bug-926489-fix.patch (obsolete) — Splinter Review
Comment on attachment 822519 [details] [diff] [review] bug-926489-fix.patch ># HG changeset patch ># User Akshay Aurora <akshayaurora2008@gmail.com> ># Date 1382734674 -19800 ># Sat Oct 26 02:27:54 2013 +0530 ># Node ID 64427d8f7bf1f4ef650507dee9f4439bb6a21663 ># Parent 9f8233fcce1d3f0676bc720303dc7bbd7e246c13 >Bug 926489 - Replace className with classList > >diff --git a/toolkit/content/widgets/datetimepicker.xml b/toolkit/content/widgets/datetimepicker.xml >--- a/toolkit/content/widgets/datetimepicker.xml >+++ b/toolkit/content/widgets/datetimepicker.xml >@@ -802,18 +802,17 @@ > > this.yearLeadingZero = (numberFields[yi].length > 1); > this.monthLeadingZero = (numberFields[mi].length > 1); > this.dateLeadingZero = (numberFields[di].length > 1); > } > > this.yearField = document.getAnonymousElementByAttribute(this, "anonid", yfield); > if (!twoDigitYear) >- this.yearField.parentNode.className = >- "datetimepicker-input-subbox datetimepicker-year"; >+ this.yearField.parentNode.classList.add("datetimepicker-input-subbox", "datetimepicker-year"; > this.monthField = document.getAnonymousElementByAttribute(this, "anonid", mfield); > this.dateField = document.getAnonymousElementByAttribute(this, "anonid", dfield); > > this._fieldAMPM.parentNode.collapsed = true; > this.yearField.size = twoDigitYear ? 2 : 4; > this.yearField.maxLength = twoDigitYear ? 2 : 4; > ]]> > </body> >@@ -1173,17 +1172,17 @@ > > <handlers> > <handler event="click"> > <![CDATA[ > if (event.button != 0 || this.disabled || this.readOnly) > return; > > var target = event.originalTarget; >- if (target.className == "datepicker-gridlabel" && >+ if (target.className.contains("datepicker-gridlabel") && > target != this.selectedItem) { > this.selectedItem = target; > this._dateValue = new Date(this._displayedDate); > if (this.attachedControl) > this.attachedControl._setValueNoSync(this._dateValue); > this._fireEvent("change", this); > > if (this.attachedControl && "open" in this.attachedControl)
Attachment #822519 - Attachment is obsolete: true
Attachment #822525 - Flags: review?(jaws)
Comment on attachment 822525 [details] [diff] [review] bug-926489-fix-2.patch Review of attachment 822525 [details] [diff] [review]: ----------------------------------------------------------------- Looks good! I'm forwarding the review request to a toolkit reviewer, but I expect it to get r+ from them. When this gets checked in it may take a couple days before the changes appear within Nightly builds of Lightning.
Attachment #822525 - Flags: review?(jaws) → review?(dao)
Attachment #822525 - Flags: review?(dao) → review+
The patch has r+, so setting the checkin-needed keyword.
Keywords: checkin-needed
Keywords: checkin-needed
Whiteboard: [good first bug][mentor=jaws][lang=js] → [good first bug][mentor=jaws][lang=js][fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=jaws][lang=js][fixed-in-fx-team] → [good first bug][mentor=jaws][lang=js]
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: