Closed Bug 779434 Opened 12 years ago Closed 12 years ago

backport bug 437212 to bmo (refreshing a page does not update fields)

Categories

(bugzilla.mozilla.org :: User Interface, defect)

Production
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: glob, Assigned: glob)

References

Details

Attachments

(1 file)

the review on upstream bug 437212 appears stalled; i'd love to get this deployed on bmo sooner rather than later so as discussed i'll backport this now.
Attached patch patch v1Splinter Review
Attachment #647885 - Flags: review?(dkl)
Attachment #647885 - Attachment is patch: true
Comment on attachment 647885 [details] [diff] [review]
patch v1

Review of attachment 647885 [details] [diff] [review]:
-----------------------------------------------------------------

Tested and works as expected. r=dkl

::: js/show_bug.js
@@ +21,5 @@
> +// Force the browser to honour the selected option when a page is refreshed,
> +// but if the user hasn't explicitly selected a different option.
> +YAHOO.util.Event.onDOMReady(function() {
> +    var selects = document.getElementById('changeform').getElementsByTagName('select');
> +    for (var i = 0, l = selects.length; i < l; i++) {

nit: Why not just i < selects.length? I do not see where l is needed anywhere else. Easier to understand this way?
Attachment #647885 - Flags: review?(dkl) → review+
(In reply to David Lawrence [:dkl] from comment #2)
> > +    var selects = document.getElementById('changeform').getElementsByTagName('select');
> > +    for (var i = 0, l = selects.length; i < l; i++) {
> 
> nit: Why not just i < selects.length? I do not see where l is needed
> anywhere else. Easier to understand this way?

as the length of selects doesn't change while iterating, i put it into the initialisation section of the for.  i've hit performance issues by doing for(i = 0; i < a.length; i++) in the past, especially when dealing with a dom list, as this requires the length to be recalculated with each pass of the loop.
(In reply to Byron Jones ‹:glob› from comment #3)
> as the length of selects doesn't change while iterating, i put it into the
> initialisation section of the for.  i've hit performance issues by doing
> for(i = 0; i < a.length; i++) in the past, especially when dealing with a
> dom list, as this requires the length to be recalculated with each pass of
> the loop.

Ah thanks. Never considered the performance implication of using .length over and over. So with that I learn something new :)

dkl
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.0/
added js/show_bug.js
modified template/en/default/bug/edit.html.tmpl
modified template/en/default/bug/field.html.tmpl
modified template/en/default/bug/show-header.html.tmpl
modified template/en/default/flag/list.html.tmpl
Committed revision 8264.

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.2/
added js/show_bug.js
modified template/en/default/bug/edit.html.tmpl
modified template/en/default/bug/field.html.tmpl
modified template/en/default/bug/show-header.html.tmpl
modified template/en/default/flag/list.html.tmpl
Committed revision 8281.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Blocks: 781514
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: