6

I'd like to know if there's a reliable way on modern web browsers to detect document reflows and/or repaints, or if there's any pressing interest for such a thing that might put it in a W3 spec.

I would also like to know how it can be accomplished at all using vendor-specific tricks (e.g. Mozilla apparently has a MozAfterRepaint event,) if it's not possible in a standard or cross-browser way.

Thanks.

4

1 回答 1

0

You can't measure accurately but you can predict by looking through any javascript which is a getter or setter/changer of styling, animating, adding/removing classes on elements. This can be done by using javascript to ajax all the javascript on the page to get the javascript strings, and then use regular expressions to detect where they are. Create an object of all the method names you find that do this.

If you want to capture it in realtime, you could use a combination of the above, and currying all the methods on the page to call your own mediator to marry it up with your object reference above.

于 2015-05-03T15:50:57.657 回答