yiisoft / yii2-debug

Debug Extension for Yii 2
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
202 stars 150 forks source link

UserSwitch - TypeError: Cannot read property 'addEventListener' of null #347

Closed loveorigami closed 5 years ago

loveorigami commented 5 years ago
Q A
Yii version 2.0.15.1
PHP version 7.1
Operating system Win 7

After update I can't switching from panel - TypeError: Cannot read property 'addEventListener' of null

2018-12-14_13-17-05

samdark commented 5 years ago

Would you please check if it's fixed in dev-master?

loveorigami commented 5 years ago

I am update project with dev-master. Error is not fixed

2018-12-17_9-29-40

loveorigami commented 5 years ago

In v.2.0.13 user switch works fine.

hoaaah commented 5 years ago

In v.2.0.13 user switch works fine.

Thanks, temporary rollback to 2.0.13. Looks like this issue's update ready to release shortly.

samdark commented 5 years ago

@hoaaah it's not ready for release. It's ready for adoption. That means anyone can take it, fix it and send a pull request.

loveorigami commented 5 years ago

in yii-debug 2.0.13 userswitch.js

    $('#debug-userswitch__filter').on("click", "tbody tr", function(event) {
        $('#debug-userswitch__set-identity #user_id').val($(this).data('key'));
        $('#debug-userswitch__set-identity').submit();
        event.stopPropagation();
    });

target element TR

in yii-debug 2.1.7

    on(document.getElementById('debug-userswitch__filter'), 'click', function (e) {
       if (e.target.tagName.toLowerCase() === 'tr' && e.target.parentElement.tagName.toLowerCase() === 'tbody') {
           document.getElementById('user_id').value = this.dataset.getDataAttr('key');
           document.getElementById('debug-userswitch__set-identity').submit();
           e.stopPropagation();
       }
    });

target element TD

and event is broken