Description

  1. The dbw_hide_buttons function in .../wiki/htdocs/common/js/common.js in moin 1.7.2 fails when a form element does not have a name. This may cause other javascript functions loaded by themes to not be executed under certain conditions.
  2. The problem is fixed in the 1.8.0 beta 2 version, but a var name; statement should be added after the var elem; statement.

The 1.7.2 version:

function dbw_hide_buttons() {
    var form;
    var elem;

    for (var fidx = 0; fidx < document.forms.length; fidx++) {
        form = document.forms[fidx];
        for (var eidx = 0; eidx < form.elements.length; eidx++) {
            elem = form.elements[eidx];
            name = elem.name;
            if (name.substr(0,4) == 'dbw.' && name.substr(-7) == '.submit')
                elem.style.display = 'none';
        }
    }
}

The version in 1.8.0 beta 2:

function dbw_hide_buttons() {
    var form;
    var elem;

    for (var fidx = 0; fidx < document.forms.length; fidx++) {
        form = document.forms[fidx];
        for (var eidx = 0; eidx < form.elements.length; eidx++) {
            elem = form.elements[eidx];
            name = elem.name;
                        if (name) {
                                if (name.substr(0,4) == 'dbw.' && name.substr(-7) == '.submit')
                                        elem.style.display = 'none';
                        }
        }
    }
}

Steps to reproduce

Edit a wiki page under 1.7.2 with Firefox and check the Javascript Error console. There will be a name is undefined error message.

Example

n/a

Component selection

Javascript

Details

MoinMoin Version

1.7.2

OS and Version

Ubuntu, Vista

Python Version

2.5

Server Setup

apache

Server Details

wsgi

Language you are using the wiki in (set in the browser/UserPreferences)

en

Workaround

Copy the 1.8.0 version.

Discussion

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/dbw_hide_buttons (last edited 2008-09-28 15:29:21 by ThomasWaldmann)