Force DOM redraw/refresh on Chrome/Mac

前端 未结 24 1939
轻奢々
轻奢々 2020-11-22 02:11

Every once in a while, Chrome will render perfectly valid HTML/CSS incorrectly or not at all. Digging in through the DOM inspector is often enough to get it to realize the

24条回答
  •  难免孤独
    2020-11-22 02:52

    I wanted to return all the states to the previous state (without reloading) including the elements added by jquery. The above implementation not gonna works. and I did as follows.

    // Set initial HTML description
    var defaultHTML;
    function DefaultSave() {
      defaultHTML = document.body.innerHTML;
    }
    // Restore HTML description to initial state
    function HTMLRestore() {
      document.body.innerHTML = defaultHTML;
    }
    
    
    
    DefaultSave()
    
    

提交回复
热议问题