yiisoft / jquery-pjax

pushState + ajax = pjax
http://pjax.herokuapp.com
MIT License
144 stars 40 forks source link

Allow "data-pjax" attribute with no value in handleClick function #46

Closed arogachev closed 7 years ago

arogachev commented 7 years ago

Related issue in Yii2 - https://github.com/yiisoft/yii2/issues/13300. Should be synchronized here.

This check:

// Ignore links with data-pjax="0"
if ($(link).data('pjax') == 0) {
    return;
}

needs to be modified accordingly too, because "" == 0 will evaluate to true.

Can be:

$(link).data('pjax') === 0)

(data returns 0 as number).

Or in case of a string which is returend by attr for example:

$(link).attr('data-pjax') === '0'

Or maybe even better:

parseInt($(link).data('pjax')) === 0