Unexpected 'void'

I hope someone can help with this.

How is this jslint warning resolved/fixed?

https://www.jslint.com/

How do I fix this issue in the code so that that error warning does not come up in jslint?

That is all I am trying to figure out how to do.

Resolve the jslint warning issue.

Clicking on the Home button restarts the animation.

Code: https://jsfiddle.net/qg1n3pad/

 function showHome() {
    const theActive = document.querySelector(".with-curtain.active");
    const theHides = document.querySelectorAll(".hide");
    const theBody = document.querySelector("body");
    theActive.classList.remove("active");
    theHides.forEach(function (removeHide) {
        removeHide.classList.remove("hide");
    });

    theBody.classList.remove("fade");
    void theBody.offsetWidth; //restart animation
    theBody.classList.add("fade");
}

What is the void doing there? That looks like a property, the offsetWidth. Did you mean to assign that some value?

Clicking on the Home button restarts the animation.

void theBody.offsetWidth; //forces DOM refresh

How do I restart a css animation without using void theBody.offsetWidth;?

Is that something that can be done?

Referencing that property causes a DOM refresh? What?

Granted, I’m mostly mobile now so I don’t deal much with DOMs, but that sounds nuts to me. Where are you getting this information? To the best of my knowledge, that is just a property, not some method that you are invoking.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.