Git Product home page Git Product logo

Comments (4)

jefferyto avatar jefferyto commented on June 26, 2024

Sorry, but which loop are you referring to? init() is called by the browser when the element is ready (oncontentready) or if the document is ready (ondocumentready), or if the element is already ready when the polyfill code is executed (element.readyState === "complete").

from background-size-polyfill.

meventi-stephan avatar meventi-stephan commented on June 26, 2024

For example here (file: backgroundsize.htc):

function loop() {
  processSnapshotId = window.setTimeout( function() {
    expando.processing = false;
    processSnapshot( element, expando );
  }, 0 );
}

from background-size-polyfill.

jefferyto avatar jefferyto commented on June 26, 2024

loop() is called after processSnapshot() is finished, in case takeSnapshot() was called (triggered by a property change on the target element) while processSnapshot() was running. (A "snapshot" is a record of all the relevant properties of the target element, takeSnapshot() makes this record, processSnapshot() adjusts the background div in response to the record.) At this point, the target element has been found.

Though, if the target element is modified rapidly, then processSnapshot() may be called continuously; adding a delay in the process may be beneficial (at the expense of fast updates for animation).

Can you post a test case? It would help to confirm the issue.

from background-size-polyfill.

meventi-stephan avatar meventi-stephan commented on June 26, 2024

Hmm ... this must be the hardest test case. I tried this ... but if i execute this code, Internet Explorer hang up due to memory problem.

<!DOCTYPE html>
<html>
  <head>
   <style type="text/css">
      *  {
        -webkit-background-size: contain;
        -moz-background-size: contain;
        -o-background-size: contain;
        background-size: contain;
        -ms-behavior: url(backgroundsize.min.htc);
        behavior: url(backgroundsize.min.htc);
      }
      .divClassWithImage {
        background-image: url(test.jpg);
     }
      .divClassWithoutImage {
        background-image: none;
     }
    </style>
  </head>
  <body>
    <div class="divClassWithoutImage"></div>
    <div class="divClassWithImage"></div>
    ...
    <div class="divClassWithoutImage"></div>
  </body>
</html>

from background-size-polyfill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.