WordPress.org

Ready to get started?Download WordPress

Forums

WP-Polls
TypeError: 'null' is not an object (evaluating 'qt_button.nodeType (2 posts)

  1. peterwsterling
    Member
    Posted 2 years ago #

    This plugin is causing this javascript error on the post edit page:

    TypeError: 'null' is not an object (evaluating 'qt_button.nodeType')

    I think it may be something to do with it trying to manipulate it's quick button in the text editor header.

    http://wordpress.org/extend/plugins/wp-polls/

  2. Sebastian Stein
    Member
    Posted 2 years ago #

    I've had the same problem on IE7 after I upgraded to WordPress 3.3.1

    In plugins/wp-polls/wp-polls.php change lines 294 to 304 from

    echo "\t\t".'var qt_button = qt_toolbar.lastChild;'."\n";
    echo "\t\t".'while (qt_button.nodeType != 1){'."\n";
    echo "\t\t\t".'qt_button = qt_button.previousSibling;'."\n";
    echo "\t\t".'}'."\n";
    echo "\t\t".'qt_button = qt_button.cloneNode(true);'."\n";
    echo "\t\t".'qt_button.value = pollsEdL10n.poll;'."\n";
    echo "\t\t".'qt_button.title = pollsEdL10n.insert_poll;'."\n";
    echo "\t\t".'qt_button.onclick = function () { insertPoll(\'code\', edCanvas);}'."\n";
    echo "\t\t".'qt_button.id = "ed_poll";'."\n";
    echo "\t\t".'qt_toolbar.appendChild(qt_button);'."\n";
    echo "\t".'}'."\n";

    to

    echo "\t\t".'var qt_button = qt_toolbar.lastChild;'."\n";
    echo "\t\t".'if(qt_button != null){'."\n";
    echo "\t\t\t".'while (qt_button.nodeType != 1){'."\n";
    echo "\t\t\t\t".'qt_button = qt_button.previousSibling;'."\n";
    echo "\t\t\t".'}'."\n";
    echo "\t\t\t".'qt_button = qt_button.cloneNode(true);'."\n";
    echo "\t\t\t".'qt_button.value = pollsEdL10n.poll;'."\n";
    echo "\t\t\t".'qt_button.title = pollsEdL10n.insert_poll;'."\n";
    echo "\t\t\t".'qt_button.onclick = function () { insertPoll(\'code\', edCanvas);}'."\n";
    echo "\t\t\t".'qt_button.id = "ed_poll";'."\n";
    echo "\t\t\t".'qt_toolbar.appendChild(qt_button);'."\n";
    echo "\t\t".'}'."\n";
    echo "\t".'}'."\n";

    After this change, the Poll button in HTML editor won't work anymore. But as I don't need it, this fix is fine for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags