Closed Bug 237658 Opened 20 years ago Closed 20 years ago

In <pref-fonts.js>, "Warning: redeclaration of var dataEls"

Categories

(SeaMonkey :: Preferences, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.8alpha1

People

(Reporter: timeless, Assigned: sgautherie)

Details

Attachments

(4 obsolete files)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040315

Warning: redeclaration of var dataEls
Source File: chrome://communicator/content/pref/pref-fonts.js
Line: 373, Column: 17
Source Code:
             var dataEls = selectElement.listElement.getElementsByAttribute(
"value", selectVal );
Assignee: prefs → gautheri
Severity: trivial → minor
Keywords: helpwanted
OS: Windows 2000 → All
Hardware: PC → All
Summary: Warning: redeclaration of var dataEls Source File: chrome://communicator/content/pref/pref-fonts.js → In <pref-fonts.js>, "Warning: redeclaration of var dataEls"
Target Milestone: --- → mozilla1.8alpha
Status: NEW → ASSIGNED
Attached patch (Av1) <pref-fonts.js> (obsolete) — Splinter Review
Bug fix,
plus some cleanup.

(I tried to move the modified lines to the left, as the existing code
permitted...)
Attachment #144073 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 144073 [details] [diff] [review]
(Av1) <pref-fonts.js>

'r=?':
Could you review and test it ?
Comment on attachment 144073 [details] [diff] [review]
(Av1) <pref-fonts.js>

I think I prefer the if (dataEls.length) break; logic, it's more readable. Also
is it possible to merge the two if (dataEls.length) conditions? Perhaps not.
And I still don't like it when you mess around with the indentation. Also,
seeing as you're changing it, I prefer to replace /^\s+|\s+$/ with "" instead
of that strip whitespace code.
Attachment #144073 - Attachment is obsolete: true
Attachment #144073 - Flags: review?(neil.parkwaycc.co.uk)
Attached patch (Av1b) <pref-fonts.js> (obsolete) — Splinter Review
Av1, with comment 3 suggestion(s),
except the following one which I did not understand :-(

(In reply to comment #3)
> (From update of attachment 144073 [details] [diff] [review])
> seeing as you're changing it, I prefer to replace /^\s+|\s+$/ with "" instead

> of that strip whitespace code.
Attachment #144977 - Flags: review?(neil.parkwaycc.co.uk)
the code does:
var stripWhitespace = /^\s*(.*)\s*$/;
foo.replace(stripWhitespace, "$1"));

you could do:
foo.replace(/^\s+|\s+$/,"")
Attachment #144977 - Attachment is obsolete: true
Attachment #144977 - Flags: review?(neil.parkwaycc.co.uk)
Attached patch (Av1c) <pref-fonts.js> (obsolete) — Splinter Review
Av1b, with comment 5 suggestion(s).
Attachment #145047 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 145047 [details] [diff] [review]
(Av1c) <pref-fonts.js>

>+     if (dataEls && dataEls.length)
>+       selectedItem = dataEls[0];
bz, dataEls is the return from listElement.getElementsByAttribute so there
aren't exactly a large number of elements to scan, but is there a preferred way
to do this or will this suffice in this case?
(In reply to comment #7)
> >+     if (dataEls && dataEls.length)
> >+       selectedItem = dataEls[0];

if (dataEls && dataEls.item(0))
  selectedItem = dataEls[0];

is what I'd recommend.
Attachment #145047 - Attachment is obsolete: true
Attachment #145047 - Flags: review?(neil.parkwaycc.co.uk)
Av1c, with comment 8 suggestion(s).
Attachment #146099 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #146099 - Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #146099 - Flags: superreview?(jag)
Attachment #146099 - Flags: superreview?(jag) → superreview+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment on attachment 146099 [details] [diff] [review]
(Av1d) <pref-fonts.js>
[Checked in: See comment 11]


(In reply to comment #10)
> Fix checked in.

(for the record)
A modified version was checked in.
Attachment #146099 - Attachment description: (Av1d) <pref-fonts.js> → (Av1d) <pref-fonts.js> [Checked in: See comment 11]
Attachment #146099 - Attachment is obsolete: true
(In reply to comment #11)
>A modified version was checked in.
Merge conflicts, don't you just love them ;-)
Comment on attachment 146099 [details] [diff] [review]
(Av1d) <pref-fonts.js>
[Checked in: See comment 11]

'approval1.7=?':
Trivial U.I. code cleanup, no risk.
(already on Trunk)
Attachment #146099 - Flags: approval1.7?
Comment on attachment 146099 [details] [diff] [review]
(Av1d) <pref-fonts.js>
[Checked in: See comment 11]

warning cleanups can happen on the trunk. there's not much user value, even if
the risk is low -- and warning cleanups have broken features in the past.
Attachment #146099 - Flags: approval1.7? → approval1.7-
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: